Re:Need help with setup ODBC programmatically
You translated this from C++ code didn't you ?
The correct Delphi syntax should be:
procedure SetupODBC;
var
S: String;
begin
S := 'DSN=TestSN'#0 +
'DESCRIPTION=SQLConfig Sample'#0 +
'SERVER=myServer'#0 +
'ADDRESS = myServer'#0 +
'NETWORK = dbnmpntw'#0' +
'DATABASE = phs'#0;
if SQLConfigDataSource(0,ODBC_ADD_DSN, 'SQL Server', PChar(S)) then
ShowMessage('Setup OK')
else
ShowMessage('Not setup');
end;
"frank" <fra...@qd.lucent.com> schreef in bericht
news:9342dg$rd5@nntpb.cb.lucent.com...
Quote
> Hello,
> Please tell me where I am wrong with the following code,
> Procedure setUpODBC;
> var
> p : PChar;
> begin
> p := PChar('DSN=TestSN\0' +
> 'DESCRIPTION=SQLConfig Sample\0' +
> 'SERVER=myServer\0' +
> 'ADDRESS = myServer\0' +
> 'NETWORK = dbnmpntw\0' +
> 'DATABASE = phs');
> if SQLConfigDataSource(0,ODBC_ADD_DSN,
> 'SQL Server',p) then
> showmessage('Set Up OK')
> else
> showmessage('Not Set up');
> end;
> It always show 'Not Set Up'.
> And I don't know the exact meaning of Address.
> Thanks In Advance!