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.Inv okeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +482
System.Web.UI.WebControls.ObjectDataSourceView.Inv okeMethod(ObjectDataSourceMethod method) +38
System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteUpdate(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(Gr idViewRow row, Int32
rowIndex, Boolean causesValidation) +1215
System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean
causesValidation, String validationGroup) +858
System.Web.UI.WebControls.GridView.OnBubbleEvent(O bject source, EventArgs
e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEven t(Object source,
EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBack Event(String
eventArgument) +163
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection 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?