Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can´t programatically create a DSN with user/password
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Can´t programatically create a DSN with user/password
Miscellaneous
Thread ID:
00806251
Message ID:
00806251
Views:
52
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
Next
Reply
Map
View

Click here to load this message in the networking platform