This question is locked. New answers and comments are not allowed.
Can anyone offer an explanation for this error?
The detail of the exception reads like this ...
The code that generates the exception follows. The exception occurs on the Commit ...
I have very similar code in another page that reads like this ...
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
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