var
i:=integer;
str:string;
begin
i:=0if table1.recordcount<>0 then
table1.first;
while not eof do
begin
str:=copy(fields[0].asstring,1,5);
if edit1.text=str then
inc(i);
end;
end;
i是指其中有这个字符串的数目,,,,,每次执行都死机....不知是为什么/////////(我着是平印象写的..编译已经通过了..如果少标点什么的,旧不要说了
i:=integer;
str:string;
begin
i:=0if table1.recordcount<>0 then
table1.first;
while not eof do
begin
str:=copy(fields[0].asstring,1,5);
if edit1.text=str then
inc(i);
end;
end;
i是指其中有这个字符串的数目,,,,,每次执行都死机....不知是为什么/////////(我着是平印象写的..编译已经通过了..如果少标点什么的,旧不要说了
begin
str:=copy(fields[0].asstring,1,5);
if edit1.text=str then
inc(i);
next;//移动下一条记录
end;
我的程序里是有的 。
我现在就是说为什么一执行就死机。copy函数如果找不到。fields[0].asstring的值,是不是这个原因呀
table1.first;
while not table1.eof do
begin
str:=copy(table1.fields[0].asstring,1,5);
if edit1.text=str then
inc(i);
Table1.Next
end;
table1.first;
while not table1.eof do
begin
str:=copy(fields[0].asstring,1,5);
if edit1.text=str then
inc(i);
table1.next;
end;
end;
begin
if Fields[0].isnull then //判断是否为空为空时就会出现你说的错误.
str:=''
else
str:=copy(fields[0].asstring,1,5);
if edit1.text=str then
inc(i);
table1.next;
end;