想不通的问题,请教!高分,不够再加,讨论!
数据库结构如下:
CREATE TABLE [card] (
[card_id] [nvarchar] (12) NOT NULL ,
[card_account] [nvarchar] (10) NOT NULL ,
[password] [nvarchar] (8) NOT NULL ,
[card_type] [int] NOT NULL ,
[card_amount] [int] NOT NULL ,
[exp_time] [nvarchar] (10) NOT NULL ,
[is_used] [tinyint] NOT NULL ,
[is_valid] [tinyint] NOT NULL ,
[used_time] [nvarchar] (20) NULL ,
[create_date] [nvarchar] (10) NOT NULL
)
程序代码如下:
try
with userdata.cardadoqry do
begin
close;
sql.clear;
sql.Add('select max(card_account) from card');
open;
end;
if userdata.cardadoqry.RecordCount<>0 then
begin
maxaccount:=userdata.cardadoqry.fields[0].asstring;
numaccount:=strtoint64def(maxaccount,0);
if numaccount<9999999999 then
numaccount:=numaccount+1
else numaccount:=1000000000;
edt_firstaccount.Text:=inttostr(numaccount);
end
else edt_firstaccount.Text:='1000000000';
except
MessageDlg('数据库连接失败,请重试!',mtinformation,[mbok],0);
end;
奇怪的就是,如果数据库里面一条信息都没有的话,跟踪调试发现它也不会执行
userdata.cardadoqry.RecordCount=0 的操作,而是不管怎么样,都显示Recordcount最少为1,想不通,第一次遇到! (用C/S机构的)