谁能给我分析一下它错在哪能里每次运行时就显示"c:\pu.bak"附近有错误代码为170,我真是没有办法了。procedure TForm1.Act_backExecute(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=SCMY;DataSource=P';
try
with ADOQuery1 do
begin
Close;
SQl.Clear;
SQl.Add('backup database scmy to disk = "c:\pu.bak"');
EXecSQL;
end;
showmessage('数据备份成功');
except
on e:exception do
showmessage('数据备份失败');
end;
end;
begin
ADOQuery1.Close;
ADOQuery1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=SCMY;DataSource=P';
try
with ADOQuery1 do
begin
Close;
SQl.Clear;
SQl.Add('backup database scmy to disk = "c:\pu.bak"');
EXecSQL;
end;
showmessage('数据备份成功');
except
on e:exception do
showmessage('数据备份失败');
end;
end;
注意,路径用的是单引号
SQl.Add('backup database scmy to disk ='+QUOTOSTR('c:\pu.bak'));