Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can´t programatically create a DSN with user/password
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Can´t programatically create a DSN with user/password
Divers
Thread ID:
00806251
Message ID:
00806251
Vues:
54
When trying to programtically create a DSN connection to connect via ODBC to a SQL Server, I got an error if I indicate the user/password.

However, if I comment out those two lines it works perfectly.

Here's the code:
local lcAttributes as String
declare integer SQLConfigDataSource in odbccp32.dll integer, integer, string, string
with goApp
   lcAttributes = ""
   lcAttributes = lcAttributes + "DSN=IB_CR_DSN" + chr( 0 )
   lcAttributes = lcAttributes + "DESCRIPTION=DNS del Crystal Report" + chr( 0 )
*   lcAttributes = lcAttributes + "UID=user" + chr( 0 )
*   lcAttributes = lcAttributes + "PWD=something" + chr( 0 )
   lcAttributes = lcAttributes + "SERVER=" + .GetConf( "_sql_server" ) + chr( 0 )
   lcAttributes = lcAttributes + "DATABASE=" + .GetConf( "_sql_dbase" ) + chr( 0 )
   lcAttributes = lcAttributes + "Trusted_Connection=NO" + chr( 0 )
endwith
 
* Parameter nRequest: 1 - Add, 2 - Modify, 3 - Remove
lnRet = SQLConfigDataSource( 0, 1, "SQL Server", lcAttributes )
Thanks and salu2, Pablo
Pablo van Diest (Senior Developer)
APSystems
Buenos Aires, Argentina
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform