delphi最基础的SQL查询 - Delphi / 数据库相关
我要查询X表中 收入 = Y的 字段
比如 我在SQL中 是这么输入的 slect * from X where 收入 = y
在delphi 中 y 就用edit1.text里输入
begin
adoquery1.Close;
ADOQuery1.SQL.Clear;
adoquery1.SQL.Add('select * from xmb where 收入='+''''+trim(edit1.Text)+'''');
try
adoquery1.open;
except
showmessage('没有该收入记录');
exit;
end;
这段断码的话,如果收入文本的可以执行 ,但如果收入是数值的 应该怎么修改代码!
请各位大虾指教!
注意:收入字段是数字型
好结帐了
建议这么写:
adoquery1.SQL.Add('select * from xmb where 收入:= earn')
adoquery1.Parameters.ParamValues['earn'] := trim(edit1.Text);
同意3楼的
delphi当时课设都没怎么做,哎。。。
来结账了
相关问答:
执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......
有这样一条SQL
Select Get_Costtaxrate(col1), Get_Tcostvalue(col1) from a
其中Get_Costtaxrate、Get_Tcostvalue都是函数,这两个函数里面都是查找一个大表,Get_Tcostvalue还需要调用Get_C ......