2,496
社区成员
发帖
与我相关
我的任务
分享
with ADOConnection1 do
begin
Close;
ConnectionString:='Provider=SQLOLEDB.1;'+
'Password=12345678;'+ //登录密码
'User ID=lqhpos;'+ //登录用户
'Persist Security Info=True;'+
'Data Source=(local);'+ //服务器名称
'Initial Catalog=master;'; //数据库名称
Open;
end;
ADOQuery1.Connection := ADOConnection1; //加上这句
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('use master');
SQL.Add('EXEC sp_attach_db @dbname =''posbas'', '
+'@filename1 =D:\POS\Data\POS_Data.MDF, @filename2=''D:\POS\Data\POS_log.LDF''');
ExecSQL;
end;