delphi query的delete方法
procedureTForm9.Button1Click(Sender:TObject);beginquery1.Close;query1.SQL.Clear;query...
procedure TForm9.Button1Click(Sender: TObject);
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select * from password where 用户名='+''''+edit1.text+''''+'and 密码='+''''+edit2.text+'''');
query1.Open;
if query1.RecordCount<>0 then
begin
query1.delete;
showmessage('删除成功');
end
else
begin
application.MessageBox('密码错误,请重新输入','提示',mb_ok);
edit1.SetFocus;
end;
end;
主要功能是实现用户名的删除
运行后提示错误:invalid use of keywords 展开
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select * from password where 用户名='+''''+edit1.text+''''+'and 密码='+''''+edit2.text+'''');
query1.Open;
if query1.RecordCount<>0 then
begin
query1.delete;
showmessage('删除成功');
end
else
begin
application.MessageBox('密码错误,请重新输入','提示',mb_ok);
edit1.SetFocus;
end;
end;
主要功能是实现用户名的删除
运行后提示错误:invalid use of keywords 展开
展开全部
procedure TForm9.Button1Click(Sender: TObject);
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select * from password where 用户名='+''''+edit1.text+''''+'and 密码='+''''+edit2.text+'''');
query1.Open;
if query1.RecordCount<>0 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('DELETE from password where 用户名='+''''+edit1.text+''''+'and 密码='+''''+edit2.text+'''');
query1.EXECSQL;
showmessage('删除成功');
end
else
begin
application.MessageBox('密码错误,请重新输入','提示',mb_ok);
edit1.SetFocus;
end;
end;
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('select * from password where 用户名='+''''+edit1.text+''''+'and 密码='+''''+edit2.text+'''');
query1.Open;
if query1.RecordCount<>0 then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.add('DELETE from password where 用户名='+''''+edit1.text+''''+'and 密码='+''''+edit2.text+'''');
query1.EXECSQL;
showmessage('删除成功');
end
else
begin
application.MessageBox('密码错误,请重新输入','提示',mb_ok);
edit1.SetFocus;
end;
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询