[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

Error when updating a long text string

=?iso-8859-1?B?wWf6c3Q=?=

8/26/2003 4:57:00 PM

Hi

I have a windows form app which uses a webservice to
update data using datasets. On one occasion the dataset
contains a string value who's length is a little over
32000 characters.

When that happens the web server throws a error:
A severe error occured on the current command. The
result, if any, should be discarded.

Is there a upperbound on how long a string can be sending
it inside a dataset to a webservice. Behind the scenes
there is soap etc., is the origin of the error in there or
what?

Any suggestions warmly welcomed, best regards Ágúst V.
3 Answers

Ágúst

8/27/2003 8:45:00 AM

0

This is the code.
1) From the windows form
2) From the webservice
3) From the stored procedure


1) Here is the code from the windowsform:
--
WS_Verandi_3_0.WS myWS = new WS_Verandi_3_0.WS();
Verandi_3_0_Common.TokenHandler myTH = new
Verandi_3_0_Common.TokenHandler( CodeConstants.C_Key );

WS_Verandi_3_0.DsLayout diff =
new WS_Verandi_3_0.DsLayout();
diff.Merge( DataPool.m_DsLayout.GetChanges() );

myWS.UpdateLayout( diff, myTH.GenerateToken(
DataPool.m_ThisPersonRow.Email,
DataPool.m_ThisPersonRow.Password ));
//Update locally has already taken
//place, ignore the returned value..
DataPool.m_DsLayout.AcceptChanges();
--
2) The webservice code
[WebMethod ( Description="Fall sem uppfærir DsLayout")]
public DsLayout UpdateLayout( DsLayout p_DsLayout,
string p_sToken )
{
string un = TokenDecrypt( p_sToken );
try
{
sqlAdapLayout.Update( p_DsLayout, C_Layout );
return p_DsLayout;
}
catch( SqlException sq )
{
throw NewException( sq, un );
}
catch( Exception e )
{
throw NewException( e, un );
}
finally
{
CloseConnectionIfOpen();
}
}
//Here is the code which configures the DataAdapter
//
// sqlAdapLayout
//
this.sqlAdapLayout.DeleteCommand = this.scLayoutDelete;
this.sqlAdapLayout.InsertCommand = this.scLayoutInsert;
this.sqlAdapLayout.SelectCommand =
this.scLayoutSelectForPerson;
this.sqlAdapLayout.UpdateCommand = this.scLayoutUpdate;

//And
//
// scLayoutUpdate
//
this.scLayoutUpdate.CommandText = "dbo.[spLayoutUpdate]";
this.scLayoutUpdate.CommandTimeout = 30;
this.scLayoutUpdate.CommandType =
System.Data.CommandType.StoredProcedure;
this.scLayoutUpdate.Connection = this.sqlCon;
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.ReturnValue, false,
((System.Byte)(10)), ((System.Byte)(0)), "",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FK_PersonID_Org",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "FK_PersonID",
System.Data.DataRowVersion.Original, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FormID_Org",
System.Data.SqlDbType.VarChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(0)), ((System.Byte)(0)), "FormID",
System.Data.DataRowVersion.Original, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FK_PersonID_3",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "FK_PersonID",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FormID_4",
System.Data.SqlDbType.VarChar, 50, "FormID"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@LayoutString_5",
System.Data.SqlDbType.NVarChar,
1073741823, "LayoutString"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Width_6",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "Width",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Height_7",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "Height",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@UD1_8",
System.Data.SqlDbType.VarChar, 50, "UD1"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@UD2_9",
System.Data.SqlDbType.VarChar, 50, "UD2"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@UD3_10",
System.Data.SqlDbType.VarChar, 50, "UD3"));
//(Similiar to the other SqlCommands...
--
3) The stored procedure code
CREATE PROCEDURE [spLayoutUpdate]
(@FK_PersonID_Org [int],
@FormID_Org [varchar](50),
@FK_PersonID_3 [int],
@FormID_4 [varchar](50),
@LayoutString_5 [ntext],
@Width_6 [int],
@Height_7 [int],
@UD1_8 [varchar](50),
@UD2_9 [varchar](50),
@UD3_10 [varchar](50))

AS UPDATE [Layout]

SET [FK_PersonID] = @FK_PersonID_3,
[FormID] = @FormID_4,
[LayoutString] = @LayoutString_5,
[Width] = @Width_6,
[Height] = @Height_7,
[UD1] = @UD1_8,
[UD2] = @UD2_9,
[UD3] = @UD3_10

WHERE
( [FK_PersonID] = @FK_PersonID_Org AND
[FormID] = @FormID_Org)
GO
//( The insert sp is similiar )
--

>-----Original Message-----
>Please show us your code that performs the update.
>
>"Ágúst" <agusto@vks.is> wrote in message
>news:027001c36bf3$13705620$a101280a@phx.gbl...
>Hi
>
>I have a windows form app which uses a webservice to
>update data using datasets. On one occasion the dataset
>contains a string value who's length is a little over
>32000 characters.
>
>When that happens the web server throws a error:
>A severe error occured on the current command. The
>result, if any, should be discarded.
>
>Is there a upperbound on how long a string can be sending
>it inside a dataset to a webservice. Behind the scenes
>there is soap etc., is the origin of the error in there or
>what?
>
>Any suggestions warmly welcomed, best regards Ágúst V.

Marina

8/27/2003 8:01:00 PM

0

Try declaring the parameter as what it actually is - SqlDbyType.NText, not a
long varchar.

"Ágúst" <agustvo@ru.is> wrote in message
news:081901c36c77$8ee44b20$a601280a@phx.gbl...
This is the code.
1) From the windows form
2) From the webservice
3) From the stored procedure


1) Here is the code from the windowsform:
--
WS_Verandi_3_0.WS myWS = new WS_Verandi_3_0.WS();
Verandi_3_0_Common.TokenHandler myTH = new
Verandi_3_0_Common.TokenHandler( CodeConstants.C_Key );

WS_Verandi_3_0.DsLayout diff =
new WS_Verandi_3_0.DsLayout();
diff.Merge( DataPool.m_DsLayout.GetChanges() );

myWS.UpdateLayout( diff, myTH.GenerateToken(
DataPool.m_ThisPersonRow.Email,
DataPool.m_ThisPersonRow.Password ));
//Update locally has already taken
//place, ignore the returned value..
DataPool.m_DsLayout.AcceptChanges();
--
2) The webservice code
[WebMethod ( Description="Fall sem uppfærir DsLayout")]
public DsLayout UpdateLayout( DsLayout p_DsLayout,
string p_sToken )
{
string un = TokenDecrypt( p_sToken );
try
{
sqlAdapLayout.Update( p_DsLayout, C_Layout );
return p_DsLayout;
}
catch( SqlException sq )
{
throw NewException( sq, un );
}
catch( Exception e )
{
throw NewException( e, un );
}
finally
{
CloseConnectionIfOpen();
}
}
//Here is the code which configures the DataAdapter
//
// sqlAdapLayout
//
this.sqlAdapLayout.DeleteCommand = this.scLayoutDelete;
this.sqlAdapLayout.InsertCommand = this.scLayoutInsert;
this.sqlAdapLayout.SelectCommand =
this.scLayoutSelectForPerson;
this.sqlAdapLayout.UpdateCommand = this.scLayoutUpdate;

//And
//
// scLayoutUpdate
//
this.scLayoutUpdate.CommandText = "dbo.[spLayoutUpdate]";
this.scLayoutUpdate.CommandTimeout = 30;
this.scLayoutUpdate.CommandType =
System.Data.CommandType.StoredProcedure;
this.scLayoutUpdate.Connection = this.sqlCon;
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.ReturnValue, false,
((System.Byte)(10)), ((System.Byte)(0)), "",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FK_PersonID_Org",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "FK_PersonID",
System.Data.DataRowVersion.Original, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FormID_Org",
System.Data.SqlDbType.VarChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(0)), ((System.Byte)(0)), "FormID",
System.Data.DataRowVersion.Original, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FK_PersonID_3",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "FK_PersonID",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FormID_4",
System.Data.SqlDbType.VarChar, 50, "FormID"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@LayoutString_5",
System.Data.SqlDbType.NVarChar,
1073741823, "LayoutString"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Width_6",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "Width",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Height_7",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, false, ((System.Byte)
(10)), ((System.Byte)(0)), "Height",
System.Data.DataRowVersion.Current, null));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@UD1_8",
System.Data.SqlDbType.VarChar, 50, "UD1"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@UD2_9",
System.Data.SqlDbType.VarChar, 50, "UD2"));
this.scLayoutUpdate.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@UD3_10",
System.Data.SqlDbType.VarChar, 50, "UD3"));
//(Similiar to the other SqlCommands...
--
3) The stored procedure code
CREATE PROCEDURE [spLayoutUpdate]
(@FK_PersonID_Org [int],
@FormID_Org [varchar](50),
@FK_PersonID_3 [int],
@FormID_4 [varchar](50),
@LayoutString_5 [ntext],
@Width_6 [int],
@Height_7 [int],
@UD1_8 [varchar](50),
@UD2_9 [varchar](50),
@UD3_10 [varchar](50))

AS UPDATE [Layout]

SET [FK_PersonID] = @FK_PersonID_3,
[FormID] = @FormID_4,
[LayoutString] = @LayoutString_5,
[Width] = @Width_6,
[Height] = @Height_7,
[UD1] = @UD1_8,
[UD2] = @UD2_9,
[UD3] = @UD3_10

WHERE
( [FK_PersonID] = @FK_PersonID_Org AND
[FormID] = @FormID_Org)
GO
//( The insert sp is similiar )
--

>-----Original Message-----
>Please show us your code that performs the update.
>
>"Ágúst" <agusto@vks.is> wrote in message
>news:027001c36bf3$13705620$a101280a@phx.gbl...
>Hi
>
>I have a windows form app which uses a webservice to
>update data using datasets. On one occasion the dataset
>contains a string value who's length is a little over
>32000 characters.
>
>When that happens the web server throws a error:
>A severe error occured on the current command. The
>result, if any, should be discarded.
>
>Is there a upperbound on how long a string can be sending
>it inside a dataset to a webservice. Behind the scenes
>there is soap etc., is the origin of the error in there or
>what?
>
>Any suggestions warmly welcomed, best regards Ágúst V.


=?iso-8859-1?B?wWf6c3Q=?=

9/5/2003 6:51:00 AM

0

Hi

Thanks for responding Marina.
Actually what has happend is that I updated all my
assemblies to .NET framework 1.1. After that this error
has not returned.

And it is worth mentioning the great performance advance
that .NET framework 1.1 has over 1.0. Soo... if you have
connections... please give thanks to thoose guy's who
updated the framework :-) A great job you guy's!!!

Best regards from Iceland, Ágúst V.

>-----Original Message-----
>Try declaring the parameter as what it actually is -
SqlDbyType.NText, not a
>long varchar.
>
>"Ágúst" <agustvo@ru.is> wrote in message
>news:081901c36c77$8ee44b20$a601280a@phx.gbl...
>This is the code.
>1) From the windows form
>2) From the webservice
>3) From the stored procedure
>
>
>1) Here is the code from the windowsform:
>--
>WS_Verandi_3_0.WS myWS = new WS_Verandi_3_0.WS();
>Verandi_3_0_Common.TokenHandler myTH = new
>Verandi_3_0_Common.TokenHandler( CodeConstants.C_Key );
>
>WS_Verandi_3_0.DsLayout diff =
>new WS_Verandi_3_0.DsLayout();
>diff.Merge( DataPool.m_DsLayout.GetChanges() );
>
>myWS.UpdateLayout( diff, myTH.GenerateToken(
> DataPool.m_ThisPersonRow.Email,
> DataPool.m_ThisPersonRow.Password ));
>//Update locally has already taken
>//place, ignore the returned value..
>DataPool.m_DsLayout.AcceptChanges();
>--
>2) The webservice code
>[WebMethod ( Description="Fall sem uppfærir DsLayout")]
>public DsLayout UpdateLayout( DsLayout p_DsLayout,
>string p_sToken )
>{
> string un = TokenDecrypt( p_sToken );
> try
> {
> sqlAdapLayout.Update( p_DsLayout, C_Layout );
> return p_DsLayout;
> }
> catch( SqlException sq )
> {
> throw NewException( sq, un );
> }
> catch( Exception e )
> {
> throw NewException( e, un );
> }
> finally
> {
> CloseConnectionIfOpen();
> }
>}
>//Here is the code which configures the DataAdapter
>//
>// sqlAdapLayout
>//
>this.sqlAdapLayout.DeleteCommand = this.scLayoutDelete;
>this.sqlAdapLayout.InsertCommand = this.scLayoutInsert;
>this.sqlAdapLayout.SelectCommand =
>this.scLayoutSelectForPerson;
>this.sqlAdapLayout.UpdateCommand = this.scLayoutUpdate;
>
>//And
>//
>// scLayoutUpdate
>//
>this.scLayoutUpdate.CommandText = "dbo.[spLayoutUpdate]";
>this.scLayoutUpdate.CommandTimeout = 30;
>this.scLayoutUpdate.CommandType =
>System.Data.CommandType.StoredProcedure;
>this.scLayoutUpdate.Connection = this.sqlCon;
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
>System.Data.SqlDbType.Int, 4,
>System.Data.ParameterDirection.ReturnValue, false,
>((System.Byte)(10)), ((System.Byte)(0)), "",
>System.Data.DataRowVersion.Current, null));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@FK_PersonID_Org",
>System.Data.SqlDbType.Int, 4,
>System.Data.ParameterDirection.Input, false,
((System.Byte)
>(10)), ((System.Byte)(0)), "FK_PersonID",
>System.Data.DataRowVersion.Original, null));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@FormID_Org",
>System.Data.SqlDbType.VarChar, 50,
>System.Data.ParameterDirection.Input, false,
((System.Byte)
>(0)), ((System.Byte)(0)), "FormID",
>System.Data.DataRowVersion.Original, null));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@FK_PersonID_3",
>System.Data.SqlDbType.Int, 4,
>System.Data.ParameterDirection.Input, false,
((System.Byte)
>(10)), ((System.Byte)(0)), "FK_PersonID",
>System.Data.DataRowVersion.Current, null));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@FormID_4",
>System.Data.SqlDbType.VarChar, 50, "FormID"));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@LayoutString_5",
>System.Data.SqlDbType.NVarChar,
>1073741823, "LayoutString"));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@Width_6",
>System.Data.SqlDbType.Int, 4,
>System.Data.ParameterDirection.Input, false,
((System.Byte)
>(10)), ((System.Byte)(0)), "Width",
>System.Data.DataRowVersion.Current, null));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@Height_7",
>System.Data.SqlDbType.Int, 4,
>System.Data.ParameterDirection.Input, false,
((System.Byte)
>(10)), ((System.Byte)(0)), "Height",
>System.Data.DataRowVersion.Current, null));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@UD1_8",
>System.Data.SqlDbType.VarChar, 50, "UD1"));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@UD2_9",
>System.Data.SqlDbType.VarChar, 50, "UD2"));
>this.scLayoutUpdate.Parameters.Add(new
>System.Data.SqlClient.SqlParameter("@UD3_10",
>System.Data.SqlDbType.VarChar, 50, "UD3"));
>//(Similiar to the other SqlCommands...
>--
>3) The stored procedure code
>CREATE PROCEDURE [spLayoutUpdate]
>(@FK_PersonID_Org [int],
>@FormID_Org [varchar](50),
>@FK_PersonID_3 [int],
>@FormID_4 [varchar](50),
>@LayoutString_5 [ntext],
>@Width_6 [int],
>@Height_7 [int],
>@UD1_8 [varchar](50),
>@UD2_9 [varchar](50),
>@UD3_10 [varchar](50))
>
>AS UPDATE [Layout]
>
>SET [FK_PersonID] = @FK_PersonID_3,
>[FormID] = @FormID_4,
>[LayoutString] = @LayoutString_5,
>[Width] = @Width_6,
>[Height] = @Height_7,
>[UD1] = @UD1_8,
>[UD2] = @UD2_9,
>[UD3] = @UD3_10
>
>WHERE
>( [FK_PersonID] = @FK_PersonID_Org AND
>[FormID] = @FormID_Org)
>GO
>//( The insert sp is similiar )
>--
>
>>-----Original Message-----
>>Please show us your code that performs the update.
>>
>>"Ágúst" <agusto@vks.is> wrote in message
>>news:027001c36bf3$13705620$a101280a@phx.gbl...
>>Hi
>>
>>I have a windows form app which uses a webservice to
>>update data using datasets. On one occasion the dataset
>>contains a string value who's length is a little over
>>32000 characters.
>>
>>When that happens the web server throws a error:
>>A severe error occured on the current command. The
>>result, if any, should be discarded.
>>
>>Is there a upperbound on how long a string can be sending
>>it inside a dataset to a webservice. Behind the scenes
>>there is soap etc., is the origin of the error in there
or
>>what?
>>
>>Any suggestions warmly welcomed, best regards Ágúst V.
>
>
>.
>