在实现一存储过程中出错提示:查询值数目与目标字段中的数目不同这是什么意思? 我看了存储过程应该都是对的请指教!

解决方案 »

  1.   

    把你的SQL和DELPHI代码贴出来啊
      

  2.   

    我是用的access
    tbmain2表结构
    cs_id    cssj    yx_id
    ]
    //save cssj
      strCSsj:=' ';
      strCSsj := Memo1.Text ;
      if trim(strCSsj)<>'' then
      begin
          cds_combo.Close ;
          strSQL:='select * from tb_main2 where cs_id="'+edit2.Text+'" and yx_id="'+edit10.Text +'"';
          cds_combo.CommandText :=strSQL;
          cds_combo.Open ;      if cds_combo.RecordCount >0 then
          begin
            cds_combo.Close ;
            strSQL:='update tb_main2 set cssj="'+Memo1.Text+'"';
            strsql:=strsql+'where cs_id="'+edit2.Text+'" and yx_id="'+edit10.Text +'"';
          end
          else begin
            cds_combo.Close ;
            strSQL:='insert into tb_main2(cs_id,cssj,yx_id) values("'+
              edit2.Text+'","'+Memo1.Text+'","'+edit10.Text  +'")';
          end;
          cds_combo.CommandText :=strSQL;
          cds_combo.Execute ;
      end;
      

  3.   

    Access?
    存储过程?'","' -> ''',''';
    引号错了吧;
    你这个不是存储过程啊;
      

  4.   

    strSQL:='select * from tb_main2 where cs_id="'+edit2.Text+'" and yx_id="'+edit10.Text +'"';---------------------------------------------------------------------
    我能看到的好像也是这儿出错了;更改如下;试试看;
    strSQL:='select * from tb_main2 where cs_id= ' + quotedstr(edit2.Text)+' and yx_id= '+ quotedstr(edit10.Text) ;
      

  5.   

    strSQL:='select * from tb_main2 where cs_id="'+edit2.Text+'" and yx_id="'+edit10.Text +'"';更改:strSQL:='select * from tb_main2 where cs_id= ' + quotedstr(edit2.Text)+' and yx_id= '+ quotedstr(edit10.Text) ;===
    还有其它两个地方有SQL语句的地方也是同样的错误
      

  6.   

    我看了存储过程应该都是对的
    ========
    是不是确定啊?你在SQL分析器中试试看是否正确,如果正确,再把引号问题改了,还有错就再贴错误信息出来
      

  7.   

    strSQL:='select * from tb_main2 where (cs_id=''%s'')and(yx_id=''%s'')';
    strsql:=format(strsql,[edit2.text,edit10.text);
    其他的同理
      

  8.   

    上边少写了一个’]‘号,
    strSQL:='select * from tb_main2 where (cs_id=''%s'')and(yx_id=''%s'')';
    strsql:=format(strsql,[edit2.text,edit10.text]);
    其他的同理