次のパラメータを持つsproc'up_selfassessform_view'があります。
in ai_eqidentkey SYSKEY
in ai_acidentkey SYSKEY
out as_eqcomments TEXT_STRING
out as_acexplanation TEXT_STRING
-これはドメインオブジェクトです-SYSKEYは「integer」であり、TEXT_STRINGは「longvarchar」です。
次のコードを使用して、iSQLからsprocfineを呼び出すことができます。
create variable @eqcomments TEXT_STRING;
create variable @acexamples TEXT_STRING;
call up_selfassessform_view (75000146, 3, @eqcomments, @acexamples);
select @eqcomments, @acexamples;
--これはDBから正しい値を返します(したがって、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.
これは(私が思うに)理にかなっています...
しかし、問題は、フィールドのサイズがわからないことです(varchar(XXX)とは異なり、これは「長いvarchar」であり、事前に定義された長さはありません)。
とにかく、楽しみのために、私は以下を追加します:
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。