0

Hi
I am new to SQL and I am trying to connect to mssql server via vb.net with a code someone else has done. I am not sure why it won't connect. part of the code is below:

_DBConnection = New SqlConnection '(ConnectionString)
_DBConnection.ConnectionString = "Server=MASTEC;Database=CHH_Cardboard_DA_new;User ID=sa;Password=xxxx;Trusted_Connection=False"
_DBConnection.Open()


when I run this I get the following error:

"A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error."


I am able to connect using odbcconnection but the rest of the code uses commands from System.Data.SqlClient.

Can anyone help me please. :-|

Thank you

4
Contributors
3
Replies
5
Views
11 Years
Discussion Span
Last Post by jbennet
0

Please cut/copy/paste your code.. so that I can say what exactly is going wrong.

Thanks

Dim strDBConn As String = ""
Try
strDBConn = "Data Source=ccmsserver;Initial Catalog=db1;User ID=kamilia;Password=501011;"
Catch ex As Exception
End Try
Return strDBConn

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.