数据库结构如下: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机构的)
[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机构的)
解决方案 »
- 你能从这个xml看出界面实现是用的哪个库吗?
- 父进程创建子进程,子进程如何得到父进程的句柄或PID?
- delphi 读取其它应用程序中Spreadsheet控件中的全部数据
- 一个删除动态生成控件的问题
- 如何用SOCKET发送一个记录?
- 耍了三年的女朋友今天给我提出分手,欲哭无泪,只有散分了。
- 怎样彻底Free掉动态创建的webbrowser,释放占用的内存??---Free好像不能,Quit也不可以!
- 哪里有delphi6.0 的书下载
- 关于fastreport的一个问题,保证送分
- 枚举子窗口不成功?
- 利用 adoquery 生成数据库以及表??
- 怎样在程序运时弹出一对话框或窗体,持续5秒后再自动消失?
if not fields[0].isNull 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';