Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I build System DSN?
Message
De
26/08/2002 13:16:26
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
How can I build System DSN?
Divers
Thread ID:
00693733
Message ID:
00693733
Vues:
78
All,

I wrote some code to build ODBC DSN. But I just can build ODBC user DSN but I can not build any system DSN. I don't why.
Anyone can give me any soultion?

Ricky

The following is my code:


#DEFINE ODBC_ADD_DSN 1
#DEFINE ODBC_CONFIG_DSN 2
#DEFINE ODBC_REMOVE_DSN 3
#DEFINE vbAPINull 0
DECLARE INTEGER SQLConfigDataSource;
IN ODBCCP32.DLL;
INTEGER hwndParent,;
INTEGER fRequest ,;
STRING lpszDriver,;
STRING lpszAttributes
intRet=0
strDriver=''
strAttributes=''

strDriver = "Microsoft Visual FoxPro Driver"

strAttributes = "SourceType=DBC" + Chr(0)
strAttributes = strAttributes + "DESCRIPTION=Temp DSN" + Chr(0)
strAttributes = strAttributes + "DSN=Temp" + Chr(0)
strAttributes = strAttributes + "SourceDB=c:\pjm\database\pjm.dbc" + Chr(0)
strAttributes = strAttributes + "Exclusive=No" + Chr(0)
strAttributes = strAttributes + "Uid=" + Chr(0)
strAttributes = strAttributes + "Pwd=" + Chr(0)
intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, strDriver, strAttributes)
If intRet =1
=MESSAGEBOX( "DSN Created")
Else
=MESSAGEBOX("Create Failed")
ENDIF
CLEAR DLLS
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform