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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capture system dsn in vb

Status
Not open for further replies.

crystalhelp

Programmer
May 13, 2002
56
CA
I am working in Visual Basic and want to list all the ODBC System DSNs. I have been able to capture all the ODBC Drivers by creating a function like this:

Private Declare Function SQLDrivers Lib "ODBC32.DLL" ( _
ByVal EnvironmentHandle As Long, _
ByVal Direction As Integer, _
ByVal DriverDescription As String, _
ByVal BufferLength1 As Integer, _
ByRef DescriptionLengthPtr As Integer, _
ByVal DriverAttributes As String, _
ByVal BufferLength2 As Integer, _
ByRef AttributesLengthPtr As Integer _
) As Integer

I think the function name SQLDrivers is actually an entry point in the odbc32 dll. I would imagine that I just need to know the entry name and parameters to capture all the system dsn's. But I can't find it anywhere. Can anyone help?
 
Funny, I'm going the other way, and my declaration for the SQLDrivers function doesn't work, so thanx for yours :)

Check out the SQLDataSources function (vb6 has a great working sample of this tucked in under samples\DTS\DTSPackages\dtsexmp3\):

Code:
Private Declare Function SQLDataSources Lib "ODBC32.DLL" ( _
	ByVal henv&, _
	ByVal fDirection%, _
	ByVal szDSN$, _
	ByVal cbDSNMax%, _
	pcbDSN%, _
	ByVal szDescription$, _
	ByVal cbDescriptionMax%, _
	pcbDescription%_
) As Integer


...i think it may be what you are looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top