Solved

Connecting to SQL Server

Posted on 1998-07-15
5
180 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firemonkey keyboard covers the controls 1 37
Formula problem with Excel attachment 6 38
DBCtrlGrid, Delphi, Scroll 7 26
transition to visual .net from vb6 5 37
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
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…

856 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