高手,请进,菜鸟送分,简单问题(30分)

  • 主题发起人 主题发起人 wxm337766
  • 开始时间 开始时间
W

wxm337766

Unregistered / Unconfirmed
GUEST, unregistred user!
function TForm2.bianhao: string;
var
Query:TADOQuery;
day,df,af,strlong,strshort:string;
{longNum,}shortNum:integer;
begin
shortnum:=0;
longnum:=0;
df:=datetostr(now());
af:=copy(df,0,4);
Query:=TADOQuery.Create(self);
Query.Connection:=datamodule1.ADOConnection1;
Query.SQL.Clear;
Query.SQL.Text:='select 项目序号 from TG1';
Query.Open;
Query.Last;
strlong:=Query.Fieldbyname('项目序号').AsString;
longnum:=length(strlong);
strshort:=copy(strlong,5,(longnum-4));
shortnum:=strtoint(strshort);
shortnum:=shortnum+1;
day:=copy(strlong,0,4);
if af=day then
begin
if shortnum<10 then
result:=af+'000'+inttostr(shortnum);
if (shortnum>=10)and(shortnum<100) then
result:=af+'00'+inttostr(shortnum);
if (shortnum>=100)and(shortnum<1000) then
result:=af+'0'+inttostr(shortnum);
if shortnum>1000 then
result:=af+inttostr(shortnum);
end
else
result:=af+'0001';
Query.Close;
Query.Free;
end;
我这句有什么错误?为什么有错误?为什么strlong为空?
 
www.source520.com 再次更新近3万代码,全部免费免注册狂下载
 
strlong:=Query.Fieldbyname('项目序号').AsString;//后面是不是少了点什么东东啊.
 
自己下断点跟一下不就知道了?
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
793
import
I
I
回复
0
查看
789
import
I
I
回复
0
查看
607
import
I
I
回复
0
查看
829
import
I
I
回复
0
查看
708
import
I
后退
顶部