Solved

Connecting to SQL Server

Posted on 1998-07-15
5
177 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
Comment Utility
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
Comment Utility
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
Comment Utility
mmahdi,
why SQL 4.5?  it's several generations ago.

0
 
LVL 1

Author Comment

by:mmahdi
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 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

10 Experts available now in Live!

Get 1:1 Help Now