用ADO连接数据库的简便函数
function ConnectLocalDB(const adocon:TadoConnection;const dbname,computername:string):boolean;
begin
with adocon do
begin
Close;
LoginPrompt:=false;
//若数据库不存在时,进行判断。。。。。。
ConnectionString:='Provider=SQLOLEDB.1;'+
'Persist Security Info=False;'+
'User ID=sa;Initial Catalog='+dbname+';'+
'Data Source='+ComputerName;
try
KeepConnection:=true;
Connected:=true;
Open;
ConnectLocalDB:=true;
except
ConnectLocalDB:=false;
end;
end;
end;
数据载入中,请稍后……
- 版权所有:景洪鑫恺瑞电脑有限公司 地址:景洪宣慰大道75号
- Copyright @ 2010-2012 All Rights Reserved 点击:次
- 备案编号:滇ICP备10002615号