Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to DB

Status
Not open for further replies.

NaiDanac

Programmer
Mar 25, 2004
96
US
Hello all,
I'm having a problem connecting to my DB from Visual Studio.net. My ulimate goal is to connect to the DB and execute a few stored procedures.

Anyway, I used server explorer (Visual Studio.net) to connect to my database without any problems. I can even see the stored procedures on the db server.

I can't connect programatically however. The value of the connection string in the server explorer is:
Code:
"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MYDATABASE;Data Source=MYSERVER;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False"

When I try to pogrammatically do that in a connection string it doesn't work.

Code:
myConnection.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MYDATABASE;Data Source=MYSERVER;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False"

Do you guys know what I'm doing worng?

Thanks
 
If you are using Imports System.Data.SqlClient then the following information should be all your need to connect to the database.

Dim strConn As String = "server=ServerName;uid=Login;pwd=Password;Initial Catalog=DatabaseName"


Hope everyone is having a great day!

Thanks - Jennifer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top