我有 sproc 'up_selfassessform_view' ,它具有以下参数:
in ai_eqidentkey SYSKEY
in ai_acidentkey SYSKEY
out as_eqcomments TEXT_STRING
out as_acexplanation TEXT_STRING
- 属于域对象 - SYSKEY 是“整数”,TEXT_STRING 是“long varchar”。
我可以使用以下代码从 iSQL 调用存储过程:
create variable @eqcomments TEXT_STRING;
create variable @acexamples TEXT_STRING;
call up_selfassessform_view (75000146, 3, @eqcomments, @acexamples);
select @eqcomments, @acexamples;
- 从数据库返回正确的值(所以我知道 SPROC 很好)。
我已经像这样在 ADO.NET 中配置了 out 参数(到目前为止,它一直适用于 'integer'、'timestamp'、'varchar(255)' 等):
SAParameter as_acexplanation = cmd.CreateParameter();
as_acexplanation.Direction = ParameterDirection.Output;
as_acexplanation.ParameterName = "as_acexplanation";
as_acexplanation.SADbType = SADbType.LongVarchar;
cmd.Parameters.Add(as_acexplanation);
当我运行以下代码时:
SADataReader reader = cmd.ExecuteReader();
我收到以下错误:
Parameter[2]: the Size property has an invalid size of 0.
哪个(我想)是有道理的......
但问题是,我不知道字段的大小(它只是“long varchar”,它没有预先确定的长度 - 不像 varchar(XXX))。
无论如何,只是为了好玩,我添加以下内容:
as_acexplanation.Size = 1000;
并且上面的错误消失了,但是现在当我打电话时:
as_acexplanation.Value
我得到一个长度 = 1000 的字符串,它只是 '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0...' ( \0 重复 1000 次)。
所以我真的被困住了......对此的任何帮助将不胜感激。
干杯! ;)
托德·T。