adoset1: TADODataSet strname:='经销商';
adoset1.commandtext:='select * from itemright where item_caption ="'+strname+'"';
adoset1.open;可运行时总是提示我列名'经销商'无效,可strname只是用来查询的值,为何提示列名无效?
adoset1.commandtext:='select * from itemright where item_caption ="'+strname+'"';
adoset1.open;可运行时总是提示我列名'经销商'无效,可strname只是用来查询的值,为何提示列名无效?
query1.SQL.Clear;
query1.SQL.add('select * from gz_jbqk where c50='''+combobox1.text+'''
and c51='''+combobox2.text+'''');
query1.open;参考一下,是三个单引号!
and c51='+QuotedStr(combobox2.text));
用quotedstr会标准一些
var:strname:char;
begin
strname:='经销商';
commandtext:='select * from itemright where item_caption='''+strname+'''';
adoquery1.open;
2种
//combobox1.text:='经销商';
combobox1.text:='经销商';
commandtext:='select * form itemright where item_caption='''+combobox1.text+'''';
adoquey1.open;
试试看