dbexpress在程序设计中自动连接数据库
扫描二维码
随时随地手机看文章
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;