Archive: system::call AddDSN


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

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"

yes, i understand but it's possible to use a api function and i want understand what's wrong with the call


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.