我是用的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;
Access? 存储过程?'","' -> ''','''; 引号错了吧; 你这个不是存储过程啊;
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) ;
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语句的地方也是同样的错误
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;
存储过程?'","' -> ''',''';
引号错了吧;
你这个不是存储过程啊;
我能看到的好像也是这儿出错了;更改如下;试试看;
strSQL:='select * from tb_main2 where cs_id= ' + quotedstr(edit2.Text)+' and yx_id= '+ quotedstr(edit10.Text) ;
还有其它两个地方有SQL语句的地方也是同样的错误
========
是不是确定啊?你在SQL分析器中试试看是否正确,如果正确,再把引号问题改了,还有错就再贴错误信息出来
strsql:=format(strsql,[edit2.text,edit10.text);
其他的同理
strSQL:='select * from tb_main2 where (cs_id=''%s'')and(yx_id=''%s'')';
strsql:=format(strsql,[edit2.text,edit10.text]);
其他的同理