procedure Tselectcourseform.searchsnobuttonClick(Sender: TObject);
 var
 你看我的部分代码类型没错啊
sno:integer;
begin
  if snomaskedit.Text =''then
  begin
  showmessage('请输入要查的人的代号');
  exit;
  end;
  sno:=strtoint(snomaskedit.Text);
  snotable.open;
  if snotable.Locate('sno',sno,[])then

解决方案 »

  1.   

    你还是这样来查找吧,
    table.open;
    while not table.eof do
    begin
     if table.fieldbyname('sno').asstring<>trim(snomaskedit.text) then
     table.next;
    end;
      

  2.   

    这是我的代码
    procedure Tselectcourseform.searchsnobuttonClick(Sender: TObject);
     var
     sno:integer;
    begin
      if snomaskedit.Text =''then
      begin
      showmessage('请输入学号');
      exit;
      end;
      sno:=strtoint(snomaskedit.Text);
      snotable.open;
      if snotable.Locate('sno',sno,[])then
      begin
      snoquery.Close;
      snoquery.ParamByName('sno').AsInteger:=sno;
      snoquery.Prepare;
      snoquery.Open;
      creditallquery.close;
      creditallquery.ParamByName('sno').AsInteger:=sno;
      creditallquery.Prepare;
      creditallquery.Open;
      creditalledit.Text:=creditallquery.fields[0].asstring;
      if creditallquery.eof=creditallquery.Bof then
      creditalledit.Text :='0';
      scquery.Close;
      scquery.ParamByName('sno').AsInteger:=sno;
      scquery.Prepare;
      scquery.Open;
      statisticsquery.Close;
      statisticsquery.ParamByName('sno').AsInteger:=sno;
      statisticsquery.Prepare;
      statisticsquery.Open;
      selectcoursebutton.Enabled:=true;
      delcoursebutton.Enabled:=true;
      end
      else
      begin
      selectcoursebutton.enabled:=false;
      delcoursebutton.Enabled:=false;
      showmessage('学号输入错误,请重新输入');
      exit;
      end;
      end;
    这是什么错误啊:我建一个数据库查询我要在maskedit中输入9941222来查询此人,
    我在maskedit的editmask属性中输入的是0000000;1;_后程序也能运行可我在查询时输入
    9941222来查询时出来错误是:project mainproject.exe raised exception 
    class EDBEngineError with message 'capability not supported'.
    process stopped.
      

  3.   

    'capability not supported',是不是你输入的值超过了字段的允许范围,
    比方说字段长是2个字节的,那么最多能表示65536个数值,如果你送了10000000进去
    大概就不对了吧
      

  4.   

    是你输入的值超过了INT的最大范围呀,
    我怎么在QQ上老是看不到你的呀
      

  5.   

    我帮改了下程序,如还出错的话,在两个原因:
    1.在if snotable.Locate('sno',sno,[])then处
    2.就是我上面所说的
    procedure Tselectcourseform.searchsnobuttonClick(Sender: TObject);
     var
     sno:integer;
    begin
      if snomaskedit.Text =''then
      begin
        showmessage('请输入学号');
        exit;
      end;
      sno:=strtoint(snomaskedit.Text);
      snotable.open;
      if snotable.Locate('sno',sno,[])then
      begin
        snoquery.Close;
        snoquery.sql.text := 'select * from 你的表 where sno='+sno;
        snoquery.Open;
        creditallquery.close;
        creditallquery.sql.text := 'select * from 你的表 where sno='+sno;
        creditallquery.Open;
        creditalledit.Text:=creditallquery.fieldbyname('sno').asstring;
        if creditallquery.eof=creditallquery.Bof then
        creditalledit.Text :='0';
        scquery.Close;
        scquery.sql.text := 'select * from 你的表 where sno='+sno;
        scquery.Open;
        statisticsquery.Close;
        statisticsquery.sql.text := 'select * from 你的表 where sno='+sno;
        statisticsquery.Open;
        selectcoursebutton.Enabled:=true;
        delcoursebutton.Enabled:=true;
      end
      else
      begin
        selectcoursebutton.enabled:=false;
        delcoursebutton.Enabled:=false;
        showmessage('学号输入错误,请重新输入');
        exit;
      end;
      end;end;