菜鸟问题!如何用SQL语句删除记录呢?能不能给点例子,谢谢

解决方案 »

  1.   

    with ADOQuery1 do
      begin
        Active := False;
        SQL.Clear;
        SQL.Add('delete from T_User where UserID="' +Edit1.text +'"');
        ExecSQL;
      end;
      

  2.   

    with adoquery do
    begin
    close;
    sql.text:='delete from table where name='''+Edit1.Text+'''';
    execsql;
    end;
      

  3.   

    QUERY1.CLOSE;
    QUERY1.SQL.CLEAR;
    QUERY1.SQL.ADD('DELETE FROM TABLE1 WHERE NAME="123"');
    QUERY1.ExecSQL;
      

  4.   

    with query do
    begin
    close;
    sql.clear;
    sqt.text:='delete from table where bh='+''''+edit1.text+'''';
    execsql;end;
      

  5.   

    with ADOQuery1 do
      begin
        Active := False;
        SQL.Clear;
        SQL.Add('delete from T_User where bhID="' +Edit1.text +'"');
        ExecSQL;
      end;
      

  6.   

    with ADOQuery1 do
      begin
        Active := False;
        SQL.Clear;
        SQL.Add(delete from T_BookInfo where BookID="' +Edit1.text +'"');
        ExecSQL;
      end;
    不知你想要的是不是这个答案,希望可以对你有帮助:)
      

  7.   

    with Query1 do
    begin
         if Active then
             Close;
         Sql.Clear;
         Sql.Add('Delete From TabUser Where ...');  //过滤条件自己写
         ExecSql;
    end;
      

  8.   

    借用一下:
    QUERY1.CLOSE;
    QUERY1.SQL.CLEAR;
    QUERY1.SQL.ADD('DELETE FROM TABLE1 WHERE NAME="123"');
    QUERY1.ExecSQL;
      

  9.   

    with  query  do 
     begin
       Sql.clear;
       Sql.text:='delete from tablename where key=''''+edit1.text+'''';
       ExecSql;
     end;  这有一个要说明的是如果你用的是ORACLE 的话那一定不要用不用在 "= ''它们是不同的
    在SQLSERVER 中是相同的。
      

  10.   

    我要的是怎样从数据库中逐条读出每个记录SQL语句
    thanks
      

  11.   

    with ADOQuery1 do
      begin
        Active := False;
        SQL.Clear;
        SQL.Add('delete from T_User where UserID="' +Edit1.text +'"');
        ExecSQL;
      end;
      

  12.   

    with ADOQuery1 do
      begin
        Active := False;
        SQL.Clear;
        SQL.Add('delete from T_User where UserID="' +Edit1.text +'"');
        ExecSQL;
      end;