I want to connect to a SQL Server using ZEOS components under Windows, compiler is LAZARUS.
Here is my function:
procedure ConnecttoDatabase(Servername, Databasename: String;
aConnection: TZConnection); overload;
var
DatabaseStr: String;
begin
aConnection.Connected := False;
aConnection.Database := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + Databasename +'.mdb;Persist Security Info=False';
aConnection.HostName := Servername;
aConnection.Protocol := 'ado';
aConnection.Connected := True;
end;
Execute this function I get an "EOLE Exception" error, I need help on the correct connection string
As mentioned by mirtheil your connection string is wrong.
An easy way to get a good connection string is by using an UDL file.
Simply create a text file with extension .UDL
and then doubleclick on it from explorer. Now you get a window where you can choose from all installed drivers and choose/enter the values you need. You can click on test connection
to see if it works.
Once you get it working there, open this file in notepad and there will be a complete connectionstring.