注册 登录
编程论坛 Delphi论坛

table 控件求某字段最大,报没有申名 select 怎么?改谢谢

zhaofan7561 发布于 2014-08-15 21:31, 2789 次点击
procedure TForm1.Button3Click(Sender: TObject);
begin
//edit1.text:='ok';
//edit1.text:=inttostr(select max('题号')  from table1);
edit1.text:=select max('题号')  FROM table;
end;

报错三项
  [错误] Unit1.pas(84): Undeclared identifier: 'select'
  [错误] Unit1.pas(84): Missing operator or semicolon
  [致命错误] Project1.dpr(5): Could not compile used unit 'Unit1.pas'


表是用Database Desktop建的,题号  数据类型是 I (长整型)

我想的是将表中加入一道题时,主键‘题号’自动加一。
   我的思路是:先找到表中题号的最大值再加一放入edit1中再写入表里。
2 回复
#2
wp2319572014-08-20 14:18
sql语句不是那么用的  它得依附于相关的数据库控件
#3
volte2014-08-21 09:27
翻看下DELPHI语法
1