ho to connect to MSSQL with ADO in Lazarus

In this forum you may discuss all issues concerning the Lazarus IDE and Freepascal (both running on Windows or Linux).

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
andersonpavani
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 08.08.2018, 15:34

ho to connect to MSSQL with ADO in Lazarus

Post by andersonpavani »

someone can help with this?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: ho to connect to MSSQL with ADO in Lazarus

Post by marsupilami »

Hello :)

I assume that this works just like in Delphi. Set the protcol property to ADO and put the ADO connection string into the database property. The following example uses SQL Server with the SQL Server Native Client:

Code: Select all

//example:
ZConnection.Protocol := 'ado';
ZConnection.Database := 'Provider=SQLNCLI11.1;Initial Catalog=MyDatabase;Data Source=MyServer\MyInstance';
ZConnection.User := 'sa';
ZConnection.Password := 'MyPassword';
Best regards,

Jan
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: ho to connect to MSSQL with ADO in Lazarus

Post by miab3 »

Or maybe use ZEOS 7.3 svn 4888 and odbc_w (it will be much faster).
Then:
Driver = {SQL Server Native Client 11.0}; Server = servername; Database = master; Uid = user; Pwd = pass; MARS_Connection = yes

Michal
Post Reply