Hey guys, what am i missing here:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Using sqlConn As New SqlClient.SqlConnection(sqlConnString)
sqlConn.Open()
sqlConn.Close()
End Using
End Sub
Public Property ServerName() As String = "myip"
Public Property DatabaseName() As String = "mytable"
Public Property Login() As String = "sa"
Public Property Password() As String = "mypw"
Public Function SqlConn(Optional timeout As Integer = 0) As String
' Initialize the connection string builder for the
' underlying provider.
Dim sqlBuilder As New SqlClient.SqlConnectionStringBuilder()
' Set the properties for the data source.
sqlBuilder.DataSource = _serverName
sqlBuilder.InitialCatalog = _databaseName
sqlBuilder.IntegratedSecurity = False
sqlBuilder.MultipleActiveResultSets = True 'to avoid exception if a query uses anothe rquery internal
sqlBuilder.UserID = _Login
sqlBuilder.Password = _Password
If timeout > 0 Then
sqlBuilder.ConnectTimeout = timeout
End If
Return sqlBuilder.ToString
End Function