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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting a SQL server via ODBC 1

Status
Not open for further replies.
May 22, 2002
6
0
0
NO
Hello,

I am trying to learn this (for me) cryptic subject called Visual Basic.

And now I am woundering how to access a database lacated on an SQL server. I have configured an user DSN and here the databaseconnection vent vell.

And here it all stops.........

How can I use this DSN at the best way in my Application? I have tryed to use the data envirement but here it all stopps I am not able to access my database.

Anyone who can give me an explonation of the best way to connect to an sql-database?

Ed
 
Try something like this,

dim objConn = ADODB.Connection
Set objConn = New ADODB.Connection
objConn .ConnectionString = "PROVIDER=MSDASQL;DSN=DSNName;UID=sa;Password=;"
objConn .Open

Just replace DSNName in the connection string with your DSN Name.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top