Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I build System DSN?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00693733
Message ID:
00693742
Vues:
18
Ricky,

check Windows API # 12675.

Armin

>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

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform