Solved

Connecting to SQL Server

Posted on 1998-07-15
5
178 Views
Last Modified: 2013-11-23
Until last week, we used a foxpro db to store customer info. We have now switched to a 4.5 SQL server.

I would be grateful if someone could direct me to the right path for connecting to this database (sample code would be helpful). considering that I have very little knowledge in dealing with SQL databases.

I have heard of the DB Library for SQL servers, which contains VBSQL.OCX, which makes the process of connecting and handling queries easier than using API. We can I get the 32 version of the DB library?

Thanks
MMAHDI
0
Comment
Question by:mmahdi
5 Comments
 
LVL 4

Expert Comment

by:tomook
ID: 1465782
Well, I have never dealt with SQL Server 4.5, but in 6.X you can use ODBC and access it either through DAO, RDO, or ADO, including the associated data controls. I assume SS 4.5 has an ODBC driver.
0
 
LVL 7

Expert Comment

by:tward
ID: 1465783
Here is a function I use to connect using ODBC:

' Access & SQL*Server Database Variables '
Public dbWorkspace As Workspace
Public dbDatabase As Database
 
Public Function DatabaseLoad() As Boolean
 
  DatabaseLoad = True
 
  On Error Resume Next
  Set dbWorkspace = DBEngine.Workspaces(0)
  Set dbDatabase = dbWorkspace.OpenDatabase(DatabaseDSN, False, False, "ODBC;DATABASE=" & DatabaseName & ";UID=" & DatabaseLoginName & ";PWD=" & DatabasePassword & ";DSN=" & DatabaseDSN)
 
If Err.Number <> 0 Then
   
  Call MsgBox("SQL*Server Error:  " & Err.Description, vbOKOnly + vbCritical, "MSI*View v" & gVersion)
   
   DatabaseLoad = False
     
End If
On Error GoTo 0

End Function

0
 
LVL 9

Expert Comment

by:Dalin
ID: 1465784
mmahdi,
why SQL 4.5?  it's several generations ago.

0
 
LVL 1

Author Comment

by:mmahdi
ID: 1465785
Tward,

Thanks for the reply but I was looking to use the DB-Library included in the SQL client developer kit, ie: use VBSQL.OCX and all functions from VBSQL.BAS supplied with the kit.

Regards
mmahdi

0
 
LVL 9

Accepted Solution

by:
cymbolic earned 200 total points
ID: 1465786
There is a comprehensive discussion with examples for using VBSQL (DBLIB) in the book "Hitchiker's Guide to Visual Basic & SQL server" by W. R. Vaughn, Microsoft Press.  Get this book and your questions will be answered.  Why, I bet you can get it through amazon.com, on the web!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now