dbexpress在程序設(shè)計(jì)中自動(dòng)連接數(shù)據(jù)庫(kù)
function MSQLcon(var SQLConnection1: TSQLConnection; HS,SA,PW,DB:string):boolean;
begin
? try
??? SQLConnection1.Close;
??? SQLConnection1.Params.Clear ;
??? SQLConnection1.DriverName := 'MSSQL ';
??? SQLConnection1.GetDriverFunc := 'getSQLDriverMSSQL ';
??? SQLConnection1.LibraryName := 'dbxmss30.dll ';
??? SQLConnection1.VendorLib := 'oledb';
??? SQLConnection1.Params.Add('DriverName=MSSQL');
??? SQLConnection1.Params.Add('HostName='+HS);
??? SQLConnection1.Params.Add('DataBase='+DB);
??? SQLConnection1.Params.Add('User_Name='+SA);
??? SQLConnection1.Params.Add('Password='+PW);
??? SQLConnection1.Params.Add('Blob=0');
??? sqlconnection1.open;
? except
?? Result:=False;
?? Exit;
? end;
?? Result:=True;
end;