I have written the following code in a class as my connection string. I want to retrive data from a field in a table in my database using this connecyion string. Please how do i go about it?
Public Class ConnectionString
Public Shared Function ConnSQL() As SqlConnection
Dim connectionString As String
Dim cnn As SqlConnection
connectionString = " initial catalog=dbase; Data Source=localhost; User Id=user; Password=pass"
cnn = New SqlConnection(connectionString)
Try
cnn.Open()
Catch ex As Exception
MsgBox("Cannot open connection ! ")
Finally
cnn.Close()
End Try
Return cnn
End Function
End Class