Board index » delphi » ConnectionString and Data Link File

ConnectionString and Data Link File

I'm new using ADO.

I'm create a ODBC DSN file and configure ADOConnection.ConnectionString to
use this file. The property ConnectionString like this 'FILE
NAME=C:\sqlserver.dsn' and the property Connected are FALSE.

When I set Connected to TRUE, the proprety ConnectionString like this
'Provider=MSDASQL.1;User ID=sa;Extended Properties="DRIVER=SQL
Server;SERVER=(local);UID=sa;WSID=JATOBA;DATABASE=WA;LANGUAGE=Portugus"'.
This is the content of the file sqlserver.dsn.

If I save the project, the property ConnectionString don't use  the ODBC DSN
file ('FILE NAME=C:\sqlserver.dsn') anymore.

Why it happened? How I can always use the ODBC DSN file?

Thanks
Fabio

 

Re:ConnectionString and Data Link File


Quote
>If I save the project, the property ConnectionString don't use  the ODBC DSN
>file ('FILE NAME=C:\sqlserver.dsn') anymore.

>Why it happened? How I can always use the ODBC DSN file?

When you set the TadoConnection.connected to true in the ID it converts the
connectionstring from the data link file to the Connection string contained in
the connection file.  If you save the unit with the TadoConnection you loose the
reference to the data link file.
You best approach would be to set the connectionString property in code in the
OnCreate event

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads