connection to SQL Server 2005 Express

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Cogito
Posts: 24
Joined: Sat 05 Jul 2008 07:15

connection to SQL Server 2005 Express

Post by Cogito » Thu 13 Nov 2008 14:32

Hi,

I've no installation of sql express edition, but I need a compilation for that. How are the configuration parameters for TMSConnection component to connect to SQL Server Express with windows authentication?

Thanks.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 13 Nov 2008 15:37

To connect to SQL Server Express you should set the same TMSConnection properties as for standard SQL server, like this: Server, Database, Username, Password.
To use Windows authentication you should set the TMSConnection.Authentication property to auWindows.

Cogito
Posts: 24
Joined: Sat 05 Jul 2008 07:15

Post by Cogito » Thu 13 Nov 2008 17:53

Dimon wrote:To connect to SQL Server Express you should set the same TMSConnection properties as for standard SQL server, like this: Server, Database, Username, Password.
To use Windows authentication you should set the TMSConnection.Authentication property to auWindows.
Does it work with localhost as server name?? (Nothing with .\SQLExpress... like .NET connection?)

Can you give me a sample how I can read the connection params at runtime (especially which event should be used to read the params an what file type should it be)?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 17 Nov 2008 14:49

Cogito wrote:Does it work with localhost as server name?? (Nothing with .\SQLExpress... like .NET connection?)
Yes, for this you can set the TMSConnection.Server property to '.\SQLExpress'.
Cogito wrote:Can you give me a sample how I can read the connection params at runtime (especially which event should be used to read the params an what file type should it be)?
Please specify what params do you mean?

Cogito
Posts: 24
Joined: Sat 05 Jul 2008 07:15

Post by Cogito » Tue 18 Nov 2008 10:34

Cogito wrote:Can you give me a sample how I can read the connection params at runtime (especially which event should be used to read the params an what file type should it be)?
Please specify what params do you mean?[/quote]

I mean the logon parameter (server, database etc..). Is an ini-file ok or xml and when should they be read, in the oncreate event of datamodul?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 20 Nov 2008 07:04

To set the connection parameters at run-time you can use the following code:

Code: Select all

  MSConnection.Server := '.\SQLExpress';
  MSConnection.Database := 'DatabaseName'
  MSConnection.Authentication := auWindows;
TMSConnection does not allow to read connection parameters from file or from registry, but you can do it yourself by any convenient way. This task does not belong to SDAC tasks.

Post Reply