编译能通过,就是有能执行table1.post;总是2有问题,不知2有什么问题
bitbtn1.Tag:=6;
dbedit8.tag:=1;dbcombobox1.tag:=2;dbmemo1.tag:=3;
for i:=0 to tform.ComponentCount-1 do
 begin
 table1.Edit;
 case tform.Components[i].Tag of
 1:
   if (trim(dbedit8.Text)='') then
    application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok)
   else
    bitbtn1.Tag:=bitbtn1.Tag+1;
 2:
   if (trim(dbcombobox1.Text)='') then
    application.MessageBox('加班类型不能为空,请重新输入','输入错误',mb_ok)
   else
    bitbtn1.Tag:=bitbtn1.Tag+1;
 3:
   if (trim(dbmemo1.Text)='') then
    application.MessageBox('何事加班不能为空,请重新输入','输入错误',mb_ok)
   else
    bitbtn1.Tag:=bitbtn1.Tag+1;
 9:
   table1.Post;
 end;
 end;

解决方案 »

  1.   

    编译能通过,就是不能执行table1.post此语句;总是2有问题,不知2有什么问题
      

  2.   

    bitbtn1.Tag:=6;
    dbedit8.tag:=1;dbcombobox1.tag:=2;dbmemo1.tag:=3;
    for i:=0 to tform.ComponentCount-1 do
     begin
     table1.Edit;
     case tform.Components[i].Tag of
     1:
       if (trim(dbedit8.Text)='') then
       begin
        application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok);
        dbedit8.setfocus;
        abort;
       end;//以下相同,不然检测出空来也没有用的。
       else
        bitbtn1.Tag:=bitbtn1.Tag+1;
     2:
       if (trim(dbcombobox1.Text)='') then
        application.MessageBox('加班类型不能为空,请重新输入','输入错误',mb_ok)
       else
        bitbtn1.Tag:=bitbtn1.Tag+1;
     3:
       if (trim(dbmemo1.Text)='') then
        application.MessageBox('何事加班不能为空,请重新输入','输入错误',mb_ok)
       else
        bitbtn1.Tag:=bitbtn1.Tag+1;
     9:
       table1.Post;
     end;
     end;
      

  3.   

    table1.Post有可能执行不到啊。
      

  4.   

    没用的, 我不让它执行此段:
    if (trim(dbedit8.Text)='') then
       begin
        application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok);
        dbedit8.setfocus;
        abort;
       end;//以下相同,不然检测出空来也没有用的。
    而是执行下面else
        bitbtn1.Tag:=bitbtn1.Tag+1;,因这我dbedit8.text:='asfdkasf',
      

  5.   

    to fengjn(小枫) 为什么执行不到呀,我就是想知道!!!!!!!
      

  6.   

    case tform.Components[i].Tag of
     1:
       if (trim(dbedit8.Text)='') then
        application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok)
       else
        bitbtn1.Tag:=bitbtn1.Tag+1;
     2:
       if (trim(dbcombobox1.Text)='') then
        application.MessageBox('加班类型不能为空,请重新输入','输入错误',mb_ok)
       else
        bitbtn1.Tag:=bitbtn1.Tag+1;
     3:
       if (trim(dbmemo1.Text)='') then
        application.MessageBox('何事加班不能为空,请重新输入','输入错误',mb_ok)
       else
        bitbtn1.Tag:=bitbtn1.Tag+1;
     9:
       table1.Post;
     end;
    改成:
       if (trim(dbedit8.Text)='') then
       begin
          application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok);
          exit;
       end;    if (trim(dbcombobox1.Text)='') then
       begin
          application.MessageBox('加班类型不能为空,请重新输入','输入错误',mb_ok);
          exit;
       end;   if (trim(dbmemo1.Text)='') then
       begin
          application.MessageBox('何事加班不能为空,请重新输入','输入错误',mb_ok);
          exit;
       end;
       table1.Post;
     end;
      

  7.   

    end;
        table1.Post;///将post提出
    end;
      

  8.   

    我赞成 lincanwen(密码错误)