This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C3716A.3B7BFF80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,=20
I've an .NET application in C# who connects to a Sybase db through =
ODBC.NET data provider of the 1.1 Framework.

The code execute a simple stored procedure, GETOBJECT passing two =
parameters, an input ID and a output OBJECT. The ID field is a =
varchar(50), while the OBJECT is a VarBinary(7800).

Here is the code I use to add parametes and execute the stored =
procedure:

OdbcConnection conn =3D new OdbcConnection(strOdbcConnSybase);
OdbcCommand cmd =3D new OdbcCommand();

OdbcParameter id =3D new OdbcParameter();
id.Direction =3D ParameterDirection.Input;
id.OdbcType =3D OdbcType.VarChar;
id.Value =3D tbxKey.Text;
id.ParameterName =3D "@ID";
cmd.Parameters.Add(id);

OdbcParameter obj =3D new OdbcParameter();
obj.Direction =3D ParameterDirection.Output;
obj.OdbcType =3D OdbcType.VarBinary;
obj.Size =3D 7800;
obj.ParameterName =3D "@OBJECT";
cmd.Parameters.Add(obj);

cmd.Connection =3D conn;
cmd.CommandType =3D CommandType.Text;
cmd.CommandText =3D "{call GETOBJECT (?, ?) }";

conn.Open();
cmd.ExecuteNonQuery();
byte[] outData =3D (byte[])cmd.Parameters[1].Value;
conn.Close();

Everything works fine with the ExecuteNonQuery, but where I try to =
retrieve the output parameter OBJECT its Value is truncated to 256 =
bytes, while on the db its value is 400 bytes.

Changing the Value property of the output parameter nothing changes, =
even if I set it to 100, the returned value is 255 (being on the db of =
400 bytes). So it's clear that the Size property of the parameter has =
not been taken into account by the provider.

Any suggestions?

Bye

Luca



------=_NextPart_000_000A_01C3716A.3B7BFF80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I've an .NET application in C# who =
connects to a=20
Sybase db through ODBC.NET data provider of the 1.1 =
Framework.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The code execute a simple stored =
procedure,=20
GETOBJECT&nbsp;passing two parameters, an input ID&nbsp;and a output =
OBJECT. The=20
ID field is a varchar(50), while the OBJECT is a =
VarBinary(7800).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is the code I use to add parametes =
and execute=20
the stored procedure:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P><FONT face=3DArial size=3D2>OdbcConnection conn =3D new=20
OdbcConnection(strOdbcConnSybase);<BR>OdbcCommand cmd =3D new=20
OdbcCommand();</FONT></P>
<P><FONT face=3DArial size=3D2>OdbcParameter id =3D new=20
OdbcParameter();<BR>id.Direction =3D =
ParameterDirection.Input;<BR>id.OdbcType =3D=20
OdbcType.VarChar;<BR>id.Value =3D tbxKey.Text;<BR>id.ParameterName =3D=20
"@ID";<BR>cmd.Parameters.Add(id);</FONT></P>
<P><FONT face=3DArial size=3D2>OdbcParameter obj =3D new=20
OdbcParameter();<BR>obj.Direction =3D =
ParameterDirection.Output;<BR>obj.OdbcType =3D=20
OdbcType.VarBinary;<BR><STRONG>obj.Size =3D =
7800;</STRONG><BR>obj.ParameterName =3D=20
"@OBJECT";<BR>cmd.Parameters.Add(obj);</FONT></P>
<P><FONT face=3DArial size=3D2>cmd.Connection =3D =
conn;<BR>cmd.CommandType =3D=20
CommandType.Text;<BR>cmd.CommandText =3D "{call&nbsp;GETOBJECT (?, ?)=20
}";</FONT></P>
<P><FONT face=3DArial=20
size=3D2>conn.Open();<BR>cmd.ExecuteNonQuery();<BR><STRONG>byte[] =
outData =3D=20
(byte[])cmd.Parameters[1].Value;<BR></STRONG>conn.Close();</FONT></P>
<P><FONT face=3DArial size=3D2>Everything works fine with the =
ExecuteNonQuery, but=20
where I try to retrieve the output parameter OBJECT its Value is =
truncated to=20
256 bytes, while on the db its value is 400 bytes.</FONT></P>
<P><FONT face=3DArial size=3D2>Changing the Value property of the output =
parameter=20
nothing changes, even if I set it to 100, the returned value is 255 =
(being on=20
the db of 400 bytes). So it's clear that the Size property of the =
parameter has=20
not been taken into account by the provider.</FONT></P>
<P><FONT face=3DArial size=3D2>Any suggestions?</FONT></P>
<P><FONT face=3DArial size=3D2>Bye</FONT></P>
<P><FONT face=3DArial size=3D2>Luca</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P></DIV></BODY></HTML>

------=_NextPart_000_000A_01C3716A.3B7BFF80--