Error when updating a long text string

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Error when updating a long text string

    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.
    Ágúst Guest

  2. Similar Questions and Discussions

    1. How long is a piece of string
      I know this is a bit of a how long is piece of string question, but has anyone got any very ball park guides for the number of faces you can have in...
    2. Long String
      Hi I'm sending a long string to a web service like this ...
    3. Updating a Long VarChar field
      Hi, I'm having problems to update a LONG VARCHAR field. Suppose I have a table with two fields (the key field named TheKey, and a long varchar...
    4. How to replace a long string in a text file?
      perlwannabe wrote: From the script under you are just replacing lines with a static line/value. <snip> I don't see any reason to use hex....
    5. RAC - how long is a piece of string
      g'day folks, No experience with RAC but have been asked to estimate how long it would take to set up a RAC environment of 2 nodes with 2...
  3. #2

    Default Re: Error when updating a long text string

    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_O rg",
    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.
    Ágúst Guest

  4. #3

    Default Re: Error when updating a long text string

    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_O rg",
    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 Guest

  5. #4

    Default Re: Error when updating a long text string

    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.
    >
    >
    >.
    >
    Ágúst Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139