This is a migrated thread and some comments may be shown as answers.

Need help with error

8 Answers 111 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 25 Jul 2010, 05:21 PM
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

8 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 25 Jul 2010, 10:37 PM
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
0
Accepted
PetarP
Telerik team
answered on 26 Jul 2010, 03:34 PM
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
0
Stuart Hemming
Top achievements
Rank 2
answered on 26 Jul 2010, 03:36 PM
Fair enough. Thanks for the update.

-- 
Stuart
0
Ramya
Top achievements
Rank 1
answered on 29 Jul 2010, 03:50 PM
Petar,

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

Thanks,
Ramya
0
PetarP
Telerik team
answered on 30 Jul 2010, 03:48 PM
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
0
Ramya
Top achievements
Rank 1
answered on 30 Jul 2010, 04:19 PM
Thank You.
0
PetarP
Telerik team
answered on 05 Aug 2010, 10:59 AM
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
0
Ramya
Top achievements
Rank 1
answered on 05 Aug 2010, 02:37 PM
Thank you Petar.
Tags
General Discussions
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
PetarP
Telerik team
Ramya
Top achievements
Rank 1
Share this question
or