Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

00000005 with SQLGetInstalledDrivers

Status
Not open for further replies.

Nro

Programmer
May 15, 2001
337
CA
* I want to know all the ODBC drivers installed on one machine
* with the command SQLGetInstalledDrivers (see code).
* If I try this, I received the fatal err 00000005 from
* VFP. I Try it in VB (it crash too) and on several
* machines (Windows Me, Windows 2000 an win NT)
* I have VFP 6.0 SP5, odbccp32.dll Ver 3.520.4403.2
*
* Merci
* nro@videotron.ca
*

lcDrivers = ""
lnSize = -1
lnNewSize = 0

DECLARE Integer SQLGetInstalledDrivers in ;
odbccp32.dll String @, Short, Short @

*** Trouve tous les drivers installés dans le DLL ***
SQLGetInstalledDrivers(@lcDrivers, lnSize, @lnNewSize)

* boum !
 
Try changing your string intialization to at least:

lcDrivers = Space(1000) && ""
lnSize = 1000 && -1

this seems to work better. Like most API calls returning structures, it seems VFP needs to supply a real buffer for the API to use.

Rick
 
The API you trying to use is LOW LEVEL function and it is recommended by Microsoft NOT to use it.
One easy way to get you job done is to locate the file ODBCINST.INI in your windows root directory C:\WINNT for example. This is the text file holds all the information you need. Just start parsing it for any driver you want.
Hope this will help. Walid Magd
Engwam@Hotmail.com
 
Thanks for the answer. Now it works.
btw, the purpose to access the API is to create one DSN on the client machine with no interface. The other command I used is SQLConfigDataSource to create a VFP DSN pointing to the main application .DBC

Merci encore
Nro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top