Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling the ODBC dialog
Message
De
01/04/1999 15:54:00
 
 
À
01/04/1999 14:32:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00204397
Message ID:
00204439
Vues:
20
I do this. I bet someone else has a better way:
create cursor datasource (sourcename c(50), sourcedesc c(100), count n(3))
ODBCFILEHANDLE=FOPEN("C:\WINDOWS\ODBC.INI")
IF ODBCFILEHANDLE < 1 THEN
	WAIT WINDOW "Can't open odbc file.  Can't find c:\windows\odbc.ini.  Call Todd."
	return
endif
found_start_point = .f.
do while !found_start_point and !feof(odbcfilehandle)
	found_start_point = fgets(odbcfilehandle) # '[ODBC 32 bit Data Sources]'
enddo
if feof(odbcfilehandle) then
	wait window "Can't find ODBC section of c:\windows\odbc.ini.  Call Todd."
	return
endif
modbcline = space(20)
m.count = 999
do while !feof(odbcfilehandle)
	odbcline = fgets(odbcfilehandle)
	if odbcline = '[ODBC 32 bit Data Sources]' then
		loop
	endif
	if odbcline = '[' then
		exit
	endif
	msourceequalpos = at("=", odbcline)
	m.sourcename = left(odbcline, msourceequalpos - 1)
	m.sourcedesc = substr(odbcline, msourceequalpos + 1)
	insert into datasource from memvar
	m.count = m.count - 1
enddo
public datasource[1]
select * from datasource where sourcename # [ ] order by count into array datasource
use in datasource
mclose = fclose(odbcfilehandle)
if !mclose then
	wait window "Can't close ODBC file.  Call Todd."
	return
endif
>Hey, all:
>
> Does anybody know how to either a)build a list of ODBC connections defined to the system, and b)call the Windows ODBC dialog to allow the user to either choose or define a connection, and then return some handle for the connection they've chosen?
>
>TIA...
>
>Scott
--Todd Sherman
-Wake Up! Smell the Coffee!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform