Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat values do I pass to the Attributes parameter of SQLConfigDataSource to create a system DSN for the Microsoft Paradox Driver
    text
    copied!<p>I am trying to add a system DSN for the Microsoft Paradox Driver (ODBC) programmatically, and I cannot find any documentation on the keys that I need to pass in the attributes parameter of SQLConfigDataSource. I can successfully add an MS Access system DSN, but that is because there are a number of examples out there that include the keys (DBQ, for example). My code (Delphi), which does not work, is shown below. </p> <p>I have tried a large number of different keys, but I have not been successful. For example, I inspected the name/value pairs that appear under HKEY_LOCAL_MACHINE\Software\Wow6432Node\ODBC\ODBC.INI (32-bit ODBC) in the registry, but that didn't lead to a solution.</p> <p>Does anyone know what keys I need to pass in the lpszAttributes parameter of SQLConfigDataSource to create a Paradox system DSN programmatically?</p> <pre><code>function SQLConfigDataSource ( hwndParent: SQLHWnd; fRequest: WORD; lpszDriver: PChar; lpszAttributes: PChar ): SQLBOOL; {$IFDEF MSWINDOWS} stdcall {$ELSE} cdecl {$ENDIF}; external 'odbccp32.dll' name 'SQLConfigDataSourceW'; procedure TForm1.Button1Click(Sender: TObject); var Attributes: string; RetVal: Boolean; begin Attributes := 'DSN=' + 'Paradox Data#0; Attributes := Attributes + 'DESCRIPTION=Paradox DSN for sample data'#0; Attributes := Attributes + 'DEFAULTDIR=c:\Users\Public\Documents\RAD Studio\12.0\Samples\Data'#0#0; RetVal := SqlConfigDataSource(0, ODBC_ADD_SYS_DSN, 'Microsoft Paradox Driver (*.db)', PChar(Attributes)); if not RetVal then ShowMessage('Could not add DSN'); end; </code></pre> <hr> <p>I originally reported the answer here, but both warrenp and crefird suggested that I answer my own question (even though credit goes to crefird). You will find my answer below.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload