贴出你的source。
循环结束才出错,这可能delphi结束这个函数的时候,释放资源出错。
循环结束才出错,这可能delphi结束这个函数的时候,释放资源出错。
解决方案 »
- dataset not in edit or insert mode用的是ClientDataSet 急!!!!!
- @@@代码有点小问题,请大家多指教!谢谢@@@
- 请问哪种教育软件比较好?我想代理一下,中小学幼儿园等等都可以的
- 菜鸟在线等待,请大虾门帮帮俺
- 如何取到0-9的随机数?(急)
- 处理字符串的问题.
- 救急!!!TBitmap 打印输出的问题
- 哪位能比较详细的说明用ADO组件连接到SQL SERVER 2000(安装在本地盘)的过程吗?不胜感激~~~
- 加了分后要散分了!请链接!
- 哪里有斑马(zebra)条码打印机的汉字输出函数或控件??(所有分送出!!)
- D6 + ADO + ORACLE9i 不能增加新纪录
- 怎么改变一个form的背景图片,让它可以层铺显示一个图片??
for l:=1 to cycle do //这里出错,如果cycle是3,当l:=4时
begin
setlength(tempstr,cycle*num);
j:=0;
ssql:='insert into sc_route_shift values(:tename,:grname,:shname';
si:=0;
while j<n do
begin
if si<cycle*num then
begin
ynum:=0;
nnum:=0;
ypos:=0;
npos:=0;
if shift_array[j]=l then
begin
sc.comp_ADOQuery1.Active:=false;
sc.comp_ADOQuery1.SQL.Clear;
sc.comp_ADOQuery1.SQL.Add('select route_train1,route_train2,start_time1,arrive_time1,');
sc.comp_ADOQuery1.SQL.Add('start_time2,arrive_time2 from sc_little_route');
sc.comp_ADOQuery1.SQL.Add('where route_id=:routeid');
sc.comp_ADOQuery1.Parameters.ParamByName('routeid').value:=route_array[j];
sc.comp_ADOQuery1.Active:=true;
for k:=0 to 5 do
string_array[k]:=sc.comp_ADOQuery1.Fields.Fields[k].Text;
for k:=2 to 5 do
begin
ypos:=pos('Y',string_array[k]);
npos:=pos('N',string_array[k]);
if ypos<>0 then
ynum:=ynum+1;
if npos<>0 then
nnum:=nnum+1;
end;
if ynum=2 then
begin
si:=day[j]-1;
tempstr[si]:=copy(string_array[0],0,4);
tempstr[si+1]:=copy(string_array[1],0,4);
j:=j+3;
end
else if ynum=1 then
begin
si:=day[j]-1;
tempstr[si]:=copy(string_array[0],0,4)+'/'+copy(string_array[1],0,4);
j:=j+1;
end
else if nnum=1 then
begin
si:=day[j]-1;
tempstr[si]:=copy(string_array[0],0,4)+'/'+copy(string_array[1],0,4);
if si=cycle*num-1 then
tempstr[0]:='到'
else
tempstr[si+1]:='到';
j:=j+2;
end
else
begin
si:=day[j];
tempstr[si]:=copy(string_array[0],0,4)+'/'+copy(string_array[1],0,4);
j:=j+1;
end;
end
else
j:=j+1;
end
else
break;
end;
for j:=0 to cycle*num-1 do
begin
if tempstr[j]='' then
tempstr[j]:='休息';
end;
for j:=0 to 15 do
begin
if j<cycle*num then
ssql:=ssql+','+''''+tempstr[j]+''''
else
ssql:=ssql+','+'''''';
end;
ssql:=ssql+')';
sc.comp_ADOQuery1.Active:=false;
sc.comp_ADOQuery1.SQL.Clear;
sc.comp_ADOQuery1.SQL.Add(ssql);
sc.comp_ADOQuery1.Parameters.ParamByName('tename').value:=teamname;
sc.comp_ADOQuery1.Parameters.ParamByName('grname').value:=groupname;
sc.comp_ADOQuery1.Parameters.ParamByName('shname').value:=inttostr(l);
sc.comp_ADOQuery1.ExecSQL;
ssql:='';
setlength(tempstr,0);
end;其他要定义的我都定义了,而且插入数据也有的