Solved

Connecting to SQL Server

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

729 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