我在webserver 上面的程序定义了一个函数
function Tldj.DataPost(ClienData: string): string;
var i :integer;
Stemp:string;
cd:array [0..26] of string;
inputstrlen,arrayindex,i_i:integer;
myconn :Tadoconnection;
mystore :TADOStoredProc;
S_temp:string;
begin
myconn:= Tadoconnection.Create(nil);
myconn.ConnectionString :='Provider=MSDAORA.1;Password=manager;User ID=system;Data Source=LDJ';
myconn.Connected := true ;
mystore := Tadostoredproc.Create(nil);
mystore.Connection := myconn;
mystore.ProcedureName := 'insert_line_jining';
s_temp:='';
inputstrlen := length(String(Cliendata));
arrayindex := 0;
for i_i := 1 to inputstrlen do
begin
if arrayindex <=25 then
begin
stemp:= copy ( Cliendata,i_i,1);
if stemp = ';' then
begin
arrayindex := arrayindex +1;
end
else
begin
mystore.Parameters[arrayindex].Value:= mystore.Parameters[arrayindex].Value+stemp;
end;
end;
end;
mystore.ExecProc ;
s_temp:= trim(string(mystore.Parameters[26].Value));
mystore.Free ;
myconn.Free;
result := s_temp;end;
然后我在客户端调用 结果出现了List index out of bounds(0)
奇怪的是当我把此函数放到一个单独的程序里面,把客户端的字符串复制给参数的时候,却能正常运行,不知各位有没有什么办法
function Tldj.DataPost(ClienData: string): string;
var i :integer;
Stemp:string;
cd:array [0..26] of string;
inputstrlen,arrayindex,i_i:integer;
myconn :Tadoconnection;
mystore :TADOStoredProc;
S_temp:string;
begin
myconn:= Tadoconnection.Create(nil);
myconn.ConnectionString :='Provider=MSDAORA.1;Password=manager;User ID=system;Data Source=LDJ';
myconn.Connected := true ;
mystore := Tadostoredproc.Create(nil);
mystore.Connection := myconn;
mystore.ProcedureName := 'insert_line_jining';
s_temp:='';
inputstrlen := length(String(Cliendata));
arrayindex := 0;
for i_i := 1 to inputstrlen do
begin
if arrayindex <=25 then
begin
stemp:= copy ( Cliendata,i_i,1);
if stemp = ';' then
begin
arrayindex := arrayindex +1;
end
else
begin
mystore.Parameters[arrayindex].Value:= mystore.Parameters[arrayindex].Value+stemp;
end;
end;
end;
mystore.ExecProc ;
s_temp:= trim(string(mystore.Parameters[26].Value));
mystore.Free ;
myconn.Free;
result := s_temp;end;
然后我在客户端调用 结果出现了List index out of bounds(0)
奇怪的是当我把此函数放到一个单独的程序里面,把客户端的字符串复制给参数的时候,却能正常运行,不知各位有没有什么办法
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货