建议使用动态参数,给个例子给你: sql.Add('select * from 商品表'); sql.Add('where 商品类别=:s'); parameters.paramvalues['s']:=combobox3.text; 不容易出错
字符串 '''+Edit1.Text+''' 数值 +Edit2.txt+
建议使用参数: query1.SQL.add('select * from data where query=:variable'); query1.parameters.paramvalues['variable']:=variable;//variable可为大部分类型 query1.open; 直接用: query1.SQL.add('select * from data where query='''+edit1.text+'''');字符串query1.SQL.add('select * from data where query='''+edit1.text'''' or query=datetostr(eidt1.text));日期 query1.sql.add('select * from date where query=inttostr(edit1.text) or query=edit1.text) 形式较多!
数值'''+floattostr(variable)+'''
日期'''+datetostr(variable)+'''
sql.Add('where 商品类别=:s');
parameters.paramvalues['s']:=combobox3.text;
不容易出错
数值 +Edit2.txt+
query1.SQL.add('select * from data where query=:variable');
query1.parameters.paramvalues['variable']:=variable;//variable可为大部分类型
query1.open;
直接用:
query1.SQL.add('select * from data where query='''+edit1.text+'''');字符串query1.SQL.add('select * from data where query='''+edit1.text'''' or query=datetostr(eidt1.text));日期
query1.sql.add('select * from date where query=inttostr(edit1.text) or query=edit1.text)
形式较多!