sfoc
4th April 2006 10:07 UTC
system::call AddDSN
i try with the followed code to add a DSN, but it doesn't work
does anyone a suggestion for me?
of course i tried a search but doesn't helped me really
system
::call 'odbccp32.dll::SQLConfigDataSourceA(, i 1, t "SQL Server",t "DSN=test_DSN\0DATABASE=db1\0SERVER=srv1\0DESCRIPTION=test") i .r0'
system::call 'odbccp32.dll::SQLConfigDataSourceA(, i 1, t "SQL Server",t "DSN=test_DSN\0DATABASE=db1\0SERVER=srv1\0DESCRIPTION=test") i .r0'
thanks
flizebogen
4th April 2006 11:19 UTC
You can do this a lot easier:
WriteRegStr HKLM "Software\\ODBC\\ODBC.INI\\ODBC Data Sources" "Servername" "SQL Server"
>WriteRegStr HKLM "Software\\ODBC\\ODBC.INI\\Servername" "Description" "Your description"
>WriteRegStr HKLM "Software\\ODBC\\ODBC.INI\\Servername" "Driver" "$SYSDIR\SQLSRV32.DLL"
>WriteRegStr HKLM "Software\\ODBCĂ\ODBC.INI\\servername" "Server" "your SQL Server"
sfoc
4th April 2006 13:15 UTC
yes, i understand but it's possible to use a api function and i want understand what's wrong with the call
kichik
4th April 2006 15:29 UTC
Shouldn't those \0 be real nulls? The System plug-in doesn't do that conversion automatically. Try using nsODBC, it should handle this for you.