function TForm1.mydata_execute(id:integer;cs:string;adoquery:tadoquery):integer;
begin
  result:=0;
  try
    adoquery.Close;
    adoquery.SQL.Text:=cs;
    if id=0 then adoquery.Open;
    if id=1 then adoquery.ExecSQL;  //执行到此处出错
  except
  on E:exception do  begin
    showmessage(e.Message);
    result:=1;
    end;
  end;
end;
procedure TForm1.delete1Click(Sender: TObject);
var
  sql,sc:string;
begin
  sc:=adoquery1.FieldByName('name').AsString;
  sql:='delete from stu where name='+sc+'';
  mydata_execute(1,sql,adoquery2);  //
end;
执行上面调用处,提示odbc microsoft access drive 参数不足 ,期待1,哪位能帮看下,多谢

解决方案 »

  1.   

    看你的程序,应该是用adoconnection联接数据库
    你先在开发环境中看看联接数据库是否正常
      

  2.   

     sql:='delete   from   stu   where   name='+sc+''; 应该改为:
     sql:='delete   from   stu   where   name='''+sc+''''; 
      

  3.   

            adoquery.Close; 
            adoquery.SQL.Text:=cs; 
    改为:
            adoquery.Close;
            adoquery.SQL.Clear;
            adoquery.SQL.Text:=cs; 
    可能是因为你不加这个,所以前面试0时得后面再试1时就错误