我遇到这样的问题了,不知道怎么解决,sql语句是对的,在Access查询视图是可以查询到的,但是就是adoquery1.fieldbyname('pzid').asstring;
或者是adoquery1.fiels[0].asstring;取到的值都是空的,判断adoquery1.eof/bof都是为false说明纪录不为空。不知道大家有没有遇到类似的问题。举例:
Access 数据库
表名:table1
------------------------------------------------------------------------
编号 一级编码 二级编码 其它信息
---------------+----------------------+-------------------+-------------
0010023 | 001 | 002 | 001003002
--------+----------------+---------------+--------------
0030028 | 004 | 002 | 222212312
--------+----------------+---------------+--------------
0030021 | 005 | 008 | 222212312
--------+----------------+---------------+--------------
0030024 | 003 | 007 | 222212312
--------+----------------+---------------+--------------
0030023 | 003 | 007 | 222212312
--------------------------------------------------------
我的sql语句是
select max(编号) as test from table1 where 一级编码='001' and 二级编码='002'
adoquery1.Fields[0].asString记录集不为空时可以得到值;但是如果我增加条件
select max(编号) as test from table1 where 一级编码='001' and 二级编码='002' and 编码 like '001002*'
记录集不为空得到值是空的,不知道什么原因。
同时也关顾这个问题吧
http://community.csdn.net/Expert/topic/4124/4124641.xml?temp=.4359095
或者是adoquery1.fiels[0].asstring;取到的值都是空的,判断adoquery1.eof/bof都是为false说明纪录不为空。不知道大家有没有遇到类似的问题。举例:
Access 数据库
表名:table1
------------------------------------------------------------------------
编号 一级编码 二级编码 其它信息
---------------+----------------------+-------------------+-------------
0010023 | 001 | 002 | 001003002
--------+----------------+---------------+--------------
0030028 | 004 | 002 | 222212312
--------+----------------+---------------+--------------
0030021 | 005 | 008 | 222212312
--------+----------------+---------------+--------------
0030024 | 003 | 007 | 222212312
--------+----------------+---------------+--------------
0030023 | 003 | 007 | 222212312
--------------------------------------------------------
我的sql语句是
select max(编号) as test from table1 where 一级编码='001' and 二级编码='002'
adoquery1.Fields[0].asString记录集不为空时可以得到值;但是如果我增加条件
select max(编号) as test from table1 where 一级编码='001' and 二级编码='002' and 编码 like '001002*'
记录集不为空得到值是空的,不知道什么原因。
同时也关顾这个问题吧
http://community.csdn.net/Expert/topic/4124/4124641.xml?temp=.4359095
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货