在oracle那边有这样一个存储过程
wrtie_jy(string hpzl, string hphm , string clsbdh , string jyjg,datetime jyrq , string cjdw , float res , string err)。
参数说明:hpzl,字符(2) 号牌种类;
hphm,字符(15) 号牌号码;
clsbdh,字符(25) 车辆识别代号,不可空;
jyjg,字符(1) 检验结果,0-不合格,1-合格;
jyrq,日期(8) 检验日期,不可空;
cjdw,字符(64) 承检单位,不可空。
Res:返回值,0-操作正确;-1-无此记录,更新失败;-3-字段信息不符合要求;-4-插入/更新数据库失败;
err:返回值,具体的错误描述。
我使用TADOStoredProc进行调用,通过系统自身检测出来后,发现res返回参数变成了 ftbcd格式了.我试了几次.
1,o_file.Parameters.CreateParameter('RES', ftbcd, pdoutput ,8, null);创建参数时创建成BCD格式,(size不知道该设置成什么).调用后会报出一段乱码不是有效的数据.
2,o_file.Parameters.CreateParameter('RES', ftfloat, pdoutput ,8, null);会报出这个参数没有标示符号.
接收参数也定义了很多种,variant,olevariant,integer,float等等,错误仍然出错.
事后实在没办法,就改用BDE,Tquery进行调用,大致一样
返回错误是返回的fieldvalue是一种未知的数据类型.麻烦大家帮我解决一下.拜托,谢谢谢谢谢谢谢谢了啊.
大致代码
ado
{ o_file.Parameters.Clear;
o_file.ProcedureName:='WRITE_JY';
o_file.Close;
o_file.Parameters.CreateParameter('M_HPZL', ftString, pdInput , 2, NULL);
o_file.Parameters.CreateParameter('M_HPHM', ftString, pdInput , 15, NULL);
o_file.Parameters.CreateParameter('M_CLSBDH', ftString, pdInput , 25, NULL);
o_file.Parameters.CreateParameter('M_JYJG', ftString, pdInput , 1, NULL);
o_file.Parameters.CreateParameter('M_JYRQ', ftDateTime, pdInput , 8, NULL);
o_file.Parameters.CreateParameter('M_CJDW', ftString, pdInput , 64, NULL);
o_file.Parameters.CreateParameter('RES', ftbcd, pdoutput ,8, null);
o_file.Parameters.CreateParameter('ERR', ftString, pdoutput ,64, NULL);
o_file.Parameters[0].Value:=listview.Items[a].SubItems[0];
o_file.Parameters[1].Value:=listview.Items[a].Caption;
o_file.Parameters[2].Value:=listview.Items[a].SubItems[1];
o_file.Parameters[3].Value:=listview.Items[a].SubItems[2];
o_file.Parameters[4].Value:=date;
o_file.Parameters[5].Value:=listview.Items[a].SubItems[4];
o_file.prepared:=true;
o_file.ExecProc;
back:=integer(o_file.Parameters.ParamByName('RES').Value);
back_mes:=o_file.Parameters.ParamByName('ERR').Value;}
bde
{ strSQL := 'exec WRITE_JY :M_HPZL,:M_HPHM,:M_CLSBDH,:M_JYJG,:M_JYRQ,:M_CJDW,:RES output,:ERR output';
query1.Close;
query1.SQL.Clear;
query1.SQL.Text:=strsql;
query1.params.ParamByName('M_HPZL').Value:=listview.Items[a].SubItems[0];
query1.params.ParamByName('M_HPHM').Value:=listview.Items[a].Caption;
query1.params.ParamByName('M_CLSBDH').Value:=listview.Items[a].SubItems[1];
query1.params.ParamByName('M_JYJG').Value:=listview.Items[a].SubItems[2];
query1.params.ParamByName('M_JYRQ').Value:=strtodatetime(listview.Items[a].SubItems[3]);
query1.params.ParamByName('M_CJDW').Value:=listview.Items[a].SubItems[4];
query1.Prepared:=true;
query1.ExecSQL;
back:=query1.fieldbyname('res').Value;
back_mes:=query1.params.ParamByName('ERR').Value;}
wrtie_jy(string hpzl, string hphm , string clsbdh , string jyjg,datetime jyrq , string cjdw , float res , string err)。
参数说明:hpzl,字符(2) 号牌种类;
hphm,字符(15) 号牌号码;
clsbdh,字符(25) 车辆识别代号,不可空;
jyjg,字符(1) 检验结果,0-不合格,1-合格;
jyrq,日期(8) 检验日期,不可空;
cjdw,字符(64) 承检单位,不可空。
Res:返回值,0-操作正确;-1-无此记录,更新失败;-3-字段信息不符合要求;-4-插入/更新数据库失败;
err:返回值,具体的错误描述。
我使用TADOStoredProc进行调用,通过系统自身检测出来后,发现res返回参数变成了 ftbcd格式了.我试了几次.
1,o_file.Parameters.CreateParameter('RES', ftbcd, pdoutput ,8, null);创建参数时创建成BCD格式,(size不知道该设置成什么).调用后会报出一段乱码不是有效的数据.
2,o_file.Parameters.CreateParameter('RES', ftfloat, pdoutput ,8, null);会报出这个参数没有标示符号.
接收参数也定义了很多种,variant,olevariant,integer,float等等,错误仍然出错.
事后实在没办法,就改用BDE,Tquery进行调用,大致一样
返回错误是返回的fieldvalue是一种未知的数据类型.麻烦大家帮我解决一下.拜托,谢谢谢谢谢谢谢谢了啊.
大致代码
ado
{ o_file.Parameters.Clear;
o_file.ProcedureName:='WRITE_JY';
o_file.Close;
o_file.Parameters.CreateParameter('M_HPZL', ftString, pdInput , 2, NULL);
o_file.Parameters.CreateParameter('M_HPHM', ftString, pdInput , 15, NULL);
o_file.Parameters.CreateParameter('M_CLSBDH', ftString, pdInput , 25, NULL);
o_file.Parameters.CreateParameter('M_JYJG', ftString, pdInput , 1, NULL);
o_file.Parameters.CreateParameter('M_JYRQ', ftDateTime, pdInput , 8, NULL);
o_file.Parameters.CreateParameter('M_CJDW', ftString, pdInput , 64, NULL);
o_file.Parameters.CreateParameter('RES', ftbcd, pdoutput ,8, null);
o_file.Parameters.CreateParameter('ERR', ftString, pdoutput ,64, NULL);
o_file.Parameters[0].Value:=listview.Items[a].SubItems[0];
o_file.Parameters[1].Value:=listview.Items[a].Caption;
o_file.Parameters[2].Value:=listview.Items[a].SubItems[1];
o_file.Parameters[3].Value:=listview.Items[a].SubItems[2];
o_file.Parameters[4].Value:=date;
o_file.Parameters[5].Value:=listview.Items[a].SubItems[4];
o_file.prepared:=true;
o_file.ExecProc;
back:=integer(o_file.Parameters.ParamByName('RES').Value);
back_mes:=o_file.Parameters.ParamByName('ERR').Value;}
bde
{ strSQL := 'exec WRITE_JY :M_HPZL,:M_HPHM,:M_CLSBDH,:M_JYJG,:M_JYRQ,:M_CJDW,:RES output,:ERR output';
query1.Close;
query1.SQL.Clear;
query1.SQL.Text:=strsql;
query1.params.ParamByName('M_HPZL').Value:=listview.Items[a].SubItems[0];
query1.params.ParamByName('M_HPHM').Value:=listview.Items[a].Caption;
query1.params.ParamByName('M_CLSBDH').Value:=listview.Items[a].SubItems[1];
query1.params.ParamByName('M_JYJG').Value:=listview.Items[a].SubItems[2];
query1.params.ParamByName('M_JYRQ').Value:=strtodatetime(listview.Items[a].SubItems[3]);
query1.params.ParamByName('M_CJDW').Value:=listview.Items[a].SubItems[4];
query1.Prepared:=true;
query1.ExecSQL;
back:=query1.fieldbyname('res').Value;
back_mes:=query1.params.ParamByName('ERR').Value;}
不过,我很奇怪的是为什么你的存储过程当中的出差(输出参数,如此例当中的RES和ERROR)没有标识为out?
o_file.Parameters.CreateParameter('ERR', ftString, pdoutput ,64, NULL); 通过这两个参数就可以看出 我定义为output了 各位大哥拜托帮我想下办法