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当时课设都没怎么做,哎。。。
来结账了
相关问答:
已知Python 中:
s = unicode("测试", "gb2312")
s = u'\u6d4b\u8bd5'
print s
测试
在Delphi里面如何将\u6d4b\u8bd5这样的还原成Gb2312的汉字呢?
找到个方法
......
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......
我觉得mysql和sqlserver有共同的地方:
有个问题是关于表的锁问题:
进程A 进程B
select * from user where id in lock share mode(共享锁)
&nb ......