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

Connecting TO a MS SQL DB

Status
Not open for further replies.

DiggerDog

Programmer
Nov 24, 2002
60
AU
I'm new at Vb coding and want to set up a connection from my VB 6.0 project to a MS SQL Server 2000 Db

any ideas
 
Look up ADO or Active Data Objects. If it is not installed on your machine already, you will need to install MDAC (Microsoft Data Access Components) - the latest vesion is 2.8 and it is freely available from the Microsoft website at
You will need to set a reference to the Microsoft ADO library within VB. Then you can start creating objects. Look up the Connection, Command and Recordset objects on MSDN library. There should also be plenty of code within the VB 5&6 forum forum222 final tip, to easily create connection strings, create a new text file on your desktop and change it's extension to .udl You can then right-click it and set the Properties - you can set the data provider (e.g. Access, SQL, etc), the database & login information to use and test the connection. Then, close the properties dialog and open the udl file in Notepad. It will list the connection string ready to paste into your application.

It is possible to use DAO (an older slightly different way of data access, but not nearly so good on SQL Server, requiring DSNs) - but I wouldn't bother as it's pretty much dead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top