I was trying to get inserting a new record working from a GridView:
as per the example from
www().asp.net/LEARN/data-access/tutorial-53-vb.aspx
ProductsDataSource.Insert() -- in Protected Sub Products_RowCommand
I have my own
<My>DataSource.Insert()
This method call that is getting the error.
The Insert method returns an Int, some how the validation is causing it to return a boolean? totally baffling me.
Any help is appreciated:
Error is below:
System.ArgumentException was unhandled by user code
Message="Object of type 'System.Boolean' cannot be converted to type 'System.Int32'."
Source="mscorlib"
StackTrace:
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method)
at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary values)
at System.Web.UI.WebControls.ObjectDataSource.Insert()
at _Default.Milestones_Activity_RowCommand(Object sender, GridViewCommandEventArgs e) in d:\data\mmahal\My Documents\Visual Studio 2008\WebSites\erisk\Default6.aspx.vb:line 12
at System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e)
at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
at System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.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:
as per the example from
www().asp.net/LEARN/data-access/tutorial-53-vb.aspx
ProductsDataSource.Insert() -- in Protected Sub Products_RowCommand
I have my own
<My>DataSource.Insert()
This method call that is getting the error.
The Insert method returns an Int, some how the validation is causing it to return a boolean? totally baffling me.
Any help is appreciated:
Error is below:
System.ArgumentException was unhandled by user code
Message="Object of type 'System.Boolean' cannot be converted to type 'System.Int32'."
Source="mscorlib"
StackTrace:
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method)
at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary values)
at System.Web.UI.WebControls.ObjectDataSource.Insert()
at _Default.Milestones_Activity_RowCommand(Object sender, GridViewCommandEventArgs e) in d:\data\mmahal\My Documents\Visual Studio 2008\WebSites\erisk\Default6.aspx.vb:line 12
at System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e)
at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
at System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.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:
Last edited: