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 to a SQL Server database in VB5

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
0
0
GB
I have an old VB5 app which connects to an Access database and then loops through a recordest creating an array of labels for the records.

I have been asked to link to a different database which is in SQL Server 2000.

The code I used to connect to the access database was as follows:

Dim MyWrkSpace As Workspace
Dim Db As Database
Dim Rs As Recordset

Set MyWrkSpace = CreateWorkspace("MyWrkSpace", "admin", "")
Set Db = MyWrkSpace.OpenDatabase("\\ServerName\Press$\PressEnquiries.mdb")

Can anyone tell me how to alter this to connect to a SQL Server database?
 
IF...

You are wanting to continue to use DAO, then check out DAO ODBC Direct.

IF...

You installed your help files in the standard/default directory then you should be able to find the specific help file at...

C:\Program Files\Microsoft Visual Studio\MSDN98\98VS\1033

and you are looking for the

DAO351.chm file

inside there is an example (You will have to create an ODBC Data Source.

Otherwise you may want to rewrite you app with ADO or RDO.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top