Need help with error

Thread is closed for posting
9 posts, 1 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 25 Jul 2010 Link to this post

    Can anyone offer an explanation for this error?
    Insert of '1855203483-' failed: Telerik.OpenAccess.RT.sql.SQLException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 ("@p1"): Data type 0xE7 has an invalid data length or metadata length.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
       at OpenAccessRuntime.Relational.conn.PooledPSWithParamLogging.execute()
       at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
    INSERT INTO [lcation] ([date_deleted], [description], [is_principle_location], [addressID], [nme], [schoolID], [voa_version]) VALUES (?, ?, ?, ?, ?, ?, ?)
    select scope_identity()
    Params: [(TIMESTAMP), (LONGVARCHAR), 1, 1810, (VARCHAR), 1807, 1] Telerik.OpenAccess.RT.sql.SQLException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 ("@p1"): Data type 0xE7 has an invalid data length or metadata length.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
       at OpenAccessRuntime.Relational.conn.PooledPSWithParamLogging.execute()
       at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)

    The detail of the exception reads like this ...

    Telerik.OpenAccess.Exceptions.DataStoreException was unhandled by user code
      Message="Insert of '1855203483-' failed: Telerik.OpenAccess.RT.sql.SQLException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 (\"@p1\"): Data type 0xE7 has an invalid data length or metadata length.\r\n   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()\r\n   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()\r\n   at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)\nINSERT INTO [lcation] ([date_deleted], [description], [is_principle_location], [addressID], [nme], [schoolID], [voa_version]) VALUES (?, ?, ?, ?, ?, ?, ?)\nselect scope_identity()\n(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 (\"@p1\"): Data type 0xE7 has an invalid data length or metadata length.\r\n   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()\r\n   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()\r\n   at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)"
      Source="Telerik.OpenAccess"
      CanRetry=false
      StackTrace:
           at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
           at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x)
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
           at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.commit()
           at Telerik.OpenAccess.RT.TransactionImpl.Commit()
           at RSD.Website.Controls.SchoolDetailsView.dv_ItemInserting(Object sender, DetailsViewInsertEventArgs e) in c:\Users\Stuart\Documents\Visual Studio 2008\WebSites\RSD\Controls\School\SchoolDetailsView.ascx.cs:line 94
           at System.Web.UI.WebControls.DetailsView.OnItemInserting(DetailsViewInsertEventArgs e)
           at System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg, Boolean causesValidation)
           at System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
           at System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e)
           at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
           at System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e)
           at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
           at Telerik.Web.UI.RadToolBar.OnButtonClick(RadToolBarEventArgs e)
           at Telerik.Web.UI.RadToolBar.RaisePostBackEvent(String eventArgument)
           at Telerik.Web.UI.RadToolBar.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
           at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
           at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      InnerException: Telerik.OpenAccess.RT.sql.SQLException
           Message="The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 (\"@p1\"): Data type 0xE7 has an invalid data length or metadata length."
           Source="Telerik.OpenAccess.Adonet2"
           Description="SQLState=;The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 (\"@p1\"): Data type 0xE7 has an invalid data length or metadata length."
           ErrorCode=8016
           Number=8016
           StackTrace:
                at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
                at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
                at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
           InnerException:

    The code that generates the exception follows. The exception occurs on the Commit ...

    protected void dv_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        Scope.Transaction.Begin();
        school = new School();
        PopulateSchool();
        Scope.Add(school);
     
        Location location = new Location();
        location.IsPrincipleLocation = true;
        school.Locations.Add(location);
        PopulateLocation(location);
     
        Scope.Transaction.Commit();
        dv.ChangeMode(DetailsViewMode.ReadOnly);
        OnModeSet(new DetailsViewModeEventArgs(DetailsViewMode.ReadOnly, false));
    }
     
    void PopulateLocation(Location Location)
    {
        CountyComboBox cb = dv.FindControl("County") as CountyComboBox;
        Location.Address.AddressLine1 = (dv.FindControl("AddressLine1") as RadTextBox).Text;
        Location.Address.AddressLine2 = (dv.FindControl("AddressLine2") as RadTextBox).Text;
        Location.Address.Town = (dv.FindControl("Town") as RadTextBox).Text;
        Location.Address.County = cb.SelectedItem;
        if (String.IsNullOrEmpty(Location.Address.Country))
        {
            Location.Address.Country = "United Kingdom";
        }
        Location.Address.Postcode = (dv.FindControl("Postcode") as RadTextBox).Text;
    }
     
    void PopulateSchool()
    {
        if (School == null)
        {
            return;
        }
     
        School.Name = (dv.FindControl("Name") as RadTextBox).Text;
        School.Description = (dv.FindControl("Description") as DescriptionEditor).Content;
         
        School.IsActive = (dv.FindControl("IsActive") as CheckBox).Checked;
         
        School.DateNextRegistrationDue = (dv.FindControl("DateNextRegistrationDue") as RadDatePicker).SelectedDate;
        School.DateDeleted = (dv.FindControl("DateDeleted") as RadDatePicker).SelectedDate;
     
        if (dv.CurrentMode == DetailsViewMode.Insert)
        {
            School.DateRegistered = (dv.FindControl("DateRegistered") as RadDatePicker).SelectedDate.Value;
        }
    }

    I have very similar code in another page that reads like this ...

    protected void dv_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        if (school != null)
        {
            Scope.Transaction.Begin();
            location = new Location();
            PopulateLocation();
            location.IsPrincipleLocation = false;
            school.Locations.Add(location);
            Scope.Transaction.Commit();
        }
        dv.ChangeMode(DetailsViewMode.ReadOnly);
        OnModeSet(new DetailsViewModeEventArgs(DetailsViewMode.ReadOnly, false));
    }
     
    void PopulateLocation()
    {
        if (Location == null)
        {
            return;
        }
     
        CountyComboBox cb = dv.FindControl("County") as CountyComboBox;
     
        Location.Name = (dv.FindControl("Name") as RadTextBox).Text;
        Location.Description = (dv.FindControl("Description") as DescriptionEditor).Content;
     
        Location.Address.AddressLine1 = (dv.FindControl("AddressLine1") as RadTextBox).Text;
        Location.Address.AddressLine2 = (dv.FindControl("AddressLine2") as RadTextBox).Text;
        Location.Address.Town = (dv.FindControl("Town") as RadTextBox).Text;
        if (cb.SelectedValue != -1)
        {
            Location.Address.County = (from c in Scope.Extent<County>()
                                       where c.CountyID.Equals(cb.SelectedValue)
                                       select c).FirstOrDefault();
        }
        if (String.IsNullOrEmpty(Location.Address.Country))
        {
            Location.Address.Country = "United Kingdom";
        }
        Location.Address.Postcode = (dv.FindControl("Postcode") as RadTextBox).Text;
    }

    and that works like a charm. The first set of code adds a school and a location at the same time, the 2nd adds a location to an existing school.

    I've tried, in the first case, adding the school then updating it but get the same error.

    -- 
    Stuart
  2. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 25 Jul 2010 Link to this post

    OK.

    I've found what was generating the error, but I'll be [fx Expletive Deleted] if I know why.

    My Location table has 2 string fields; name (nvarchar(255)) and description (nvarchar(max)). I wasn't setting either of their values. In the DB they are both marked as allowing nulls.

    Can /anyone/ shed any light on this?

    -- 
    Stuart
  3. Answer
    PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 26 Jul 2010 Link to this post

    Hi Stuart Hemming,

     This was a bug that was reported and fixed several days ago. You will find it fixed in our next internal build. As a temporary workaround I can suggest you to use String.Empty as value for those fields.
    We are sorry for any inconvenience this might be causing.

    Best wishes,
    Petar
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 26 Jul 2010 Link to this post

    Fair enough. Thanks for the update.

    -- 
    Stuart
  5. Ramya
    Ramya avatar
    8 posts
    Member since:
    Nov 2009

    Posted 29 Jul 2010 Link to this post

    Petar,

        I am having the same issue. May I know when the next internal build will be available for download?

    Thanks,
    Ramya
  6. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 30 Jul 2010 Link to this post

    Hello Ramya,

     We are planning an internal build for early next week. I will post here once the build is ready and uploaded. Please excuse us for any inconvenience caused.

    Best wishes,
    Petar
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Ramya
    Ramya avatar
    8 posts
    Member since:
    Nov 2009

    Posted 30 Jul 2010 Link to this post

    Thank You.
  8. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 05 Aug 2010 Link to this post

    Hello Ramya,

     The new internal build is available for download. You should find this bug fixed with the new version.
    Thank you for your patience. 

    Regards,
    Petar
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Ramya
    Ramya avatar
    8 posts
    Member since:
    Nov 2009

    Posted 05 Aug 2010 Link to this post

    Thank you Petar.
Back to Top