Solved

Connecting to SQL Server

Posted on 1998-07-15
5
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

733 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