ObjectDataSource Error

G

Guest

I created a Dataset Type on one project which generates a DLL. I have a web
project . I created a webpage with a gridview. I attached an ObjectDatasource
to the Dataset type from my other project. I assigned the Insert, Update, and
select to the ObjectDataSource. I attached the gridview control to the
ObjectDataSource. I run it and edit a record in the grid. When I hit the
update, I get the following error:

-------------------------------------------------------------------------------
Object of type 'System.Int16' cannot be converted to type
'System.Nullable`1[System.Int32]&'.

[ArgumentException: Object of type 'System.Int16' cannot be converted to
type 'System.Nullable`1[System.Int32]&'.]
System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo
culture, BindingFlags invokeAttr) +843
System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder
binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) +199
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
skipVisibilityChecks) +325
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29

System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +482

System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method) +38
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary oldValues) +2573
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values,
IDictionary oldValues, DataSourceViewOperationCallback callback) +78
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32
rowIndex, Boolean causesValidation) +1215
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +858
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs
e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source,
EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +163

System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102




--------------------------------------------------------------------------------

Now I checked the values in the DataSource_Updating event and the fields for
update are of the correct format. What is wrong here?

Also how can I debug my DataSetType Classes. I placed a breakpoint to the
Update Method of the Dataset.Designer.vb class file, but it never breaks. The
project is referenced in the Web Project. The Dataset Type DLL is also
compiled for DEBUG. So why is it not breaking?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top