I am trying to make a database connection with Oracle using the TADOConnection
component. I added a ADOConnection1
to the form. Then I set the Provider
property to "SQLOLEDB". Consider username and password of database is 111 and 222 respectively.
Now on the OnShow
event of the form I am trying to make the database connection.
I have written a MakeConnection
function called by the OnShow
event handler:
function Tabc.MakeConnection : boolean;
var
ConnString : string;
begin
result := false;
try
ADOConnection1 := TADOConnection.Create(nil);
ADOConnection1.ConnectionString := ConnString;
ADOConnection1.LoginPrompt := false;
ADOConnection1.Open;
result := true;
except
on E : Exception do
begin
exit;
end;
end;
end;
My question is, what should be the format of the ConnString
variable? Should I use "SQLOLEDB" as provider or anything else?
Update:
Earlier I have created a connection to an Microsoft SQL Server whose connection string format is:
Provider=SQLNCLI10.1;Password=222;Persist Security Info=False;User ID= 111;Initial Catalog= abcde;Data Source= datasource\SQLEXPRESS;Initial File Name="";Server SPN=""