Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a ODBC DATASOURCE programmatically
Message
 
À
12/11/2001 03:17:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00579560
Message ID:
00580420
Vues:
25
>Yes! I try your code and it is working, but I need to specify the system table(*.mdw), userid , passward too. How can I do that?
#define ODBC_ADD_DSN 1
#define ODBC_ADD_SYS_DSN 4

Declare Long SQLConfigDataSource In ODBCCP32.DLL ;
Long hwndParent, Long fRequest, String lpszDriver, String lpszAttributes

strDriver = "Microsoft Access Driver (*.mdb)"
strAttributes = "DESCRIPTION=Temp DSN" + Chr(0)
strAttributes = strAttributes + "DSN=DSN_TEMP" + Chr(0)
strAttributes = strAttributes + "DBQ=E:\new.mdb" + Chr(0)
strAttributes = strAttributes + "DriverId=281" + Chr(0)
strAttributes = strAttributes + "FIL=MS Access" + Chr(0)
strAttributes = strAttributes + "MaxBufferSize=2048" + Chr(0)
strAttributes = strAttributes + "PageTimeout=5" + Chr(0)
strAttributes = strAttributes + "SystemDB=E:\Program Files\Microsoft Office\Office\SYSTEM.MDW" + Chr(0)
strAttributes = strAttributes + "UID=Admin" + Chr(0)
strAttributes = strAttributes + "PWD=password" + Chr(0)
intRet = SQLConfigDataSource(0, ODBC_ADD_DSN, @strDriver, @strAttributes)
If intRet = 0
   MessageBox("DSN Create Failed")
EndIf
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform