怎么将ACCESS数据库中的记录ID取最大值?

Jarrylogin 2005-03-30 07:25:16
我的记录ID的典型值为 1346340406241619408 为Text型 ,无法在delphi中转换成integer
我先要将ACCESS数据库中的记录ID取最大值+1后再写入ACCESS数据库中,高手帮忙!!!
...全文
426 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
skyewang 2005-04-05
  • 打赏
  • 举报
回复
负数就abs()一下。
Jarrylogin 2005-04-04
  • 打赏
  • 举报
回复
还是个负数呀!!
cdsgajxlp 2005-04-01
  • 打赏
  • 举报
回复
StrToInt64()
conis 2005-04-01
  • 打赏
  • 举报
回复
tgtcn(tgtcn) 是正确的
Select Max(FieldName) From[TableName]

如果你的是你ADOQuery,名字叫ADO
取得结果就是
ADO.FieldByName(0).ASString
ttjacky 2005-03-31
  • 打赏
  • 举报
回复
楼上正解
skyewang 2005-03-31
  • 打赏
  • 举报
回复
你说明的数值是19位数的,在delphi下可以用int64

//delphi代码
with tadoquery.create(nil) do
try
connection := adoconnection1;
sql.text := 'select max(id) from 表';
open;
tempstring := fields[0].asstring;
tempstring := inttostr(strtoint64(tempstring)+1);
sql.clear;
sql.text := 'insert 表(id) values('''+tempstring+''')';
execsql;
finally
close;
free;
end;


不知道这个是不是你要的。
tgtcn 2005-03-31
  • 打赏
  • 举报
回复
在一个ADOQUERY1中运行
select max(单号) as ss from 数据表

a:=adoquery1.fieldbyname('ss').asstring;

a:=a+1
...
dxhdxh 2005-03-30
  • 打赏
  • 举报
回复
floattostr(strtofloat(id)+1)
dxhdxh 2005-03-30
  • 打赏
  • 举报
回复
floatetostr(strtofloat(id)+1)
pilicat 2005-03-30
  • 打赏
  • 举报
回复
用StrToInt64()函数来进行转换。
Jarrylogin 2005-03-30
  • 打赏
  • 举报
回复
我还想问SQL语句在DELPHI中怎么写
chenminghong 2005-03-30
  • 打赏
  • 举报
回复
strtofloat(id)+1,这样不行吗?

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧