读书人

大家用ado开发有没有遇到这种关于adod

发布时间: 2012-02-17 17:50:42 作者: rapoo

大家用ado开发有没有遇到这种关于adodataset1.eof问题
关于adodataset1.eof的怎么不准呢?:

我用access库来开发,有一张表:User(username,password),
其中表中有一条记录为username=test1,password=111

adodataset1.CommandText:= 'select * from users where suser= 'test1 ' and password= '111 ';

我在程序中这样访问:
if not adodataset1.eof or not adodataset1.bof then
可以找到记录;
else
找不到记录;

可是执行后找还是提示找不到记录,后来我反过写改为:
if adodataset1.eof andadodataset1.bof then
找不到
else
  可以找到

但还是不行
请问我这样写有错吗?要怎么样写??



[解决办法]
if (not adodataset1.eof) or (not adodataset1.bof) then //估计要括号
可以找到记录;
else
找不到记录;

其实可以这样if not adodataset1.IsEmpty then 找到了

读书人网 >.NET

热点推荐