Connecting Tech Pros Worldwide Forums | Help | Site Map

Object conversion error on insert with FormView and ObjectDataSour

Dabbler
Guest
 
Posts: n/a
#1: Apr 17 '06
I'm getting the following error when I try and insert a row using FormView,
ObjectDataSource and stored procedure. The form has 40+ columns on it and I'm
not sure how to diagnose where the problem is, the data object class, the
business class etc?

Object of type 'System.Int32' cannot be converted to type 'System.String'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.ArgumentException: Object of type 'System.Int32'
cannot be converted to type 'System.String'.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: Object of type 'System.Int32' cannot be converted to
type 'System.String'.]
System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
component, Object value) +357
System.Web.UI.WebControls.ObjectDataSourceView.Bui ldDataObject(Type
dataObjectType, IDictionary inputParameters) +237
System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteInsert(IDictionary
values) +270
System.Web.UI.DataSourceView.Insert(IDictionary values,
DataSourceViewOperationCallback callback) +72
System.Web.UI.WebControls.FormView.HandleInsert(St ring commandArg,
Boolean causesValidation) +388
System.Web.UI.WebControls.FormView.HandleEvent(Eve ntArgs e, Boolean
causesValidation, String validationGroup) +623
System.Web.UI.WebControls.FormView.OnBubbleEvent(O bject source, EventArgs
e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.FormViewRow.OnBubbleEven t(Object source,
EventArgs e) +109
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

Anu suggestions on how to diagnose this would be appreciated.

Thanks much.

Phillip Williams
Guest
 
Posts: n/a
#2: Apr 17 '06

re: Object conversion error on insert with FormView and ObjectDataSour


I think that this line of the error message
[System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
component, Object value) +357] is telling you is that a type-casting error
occured while attempting to set a public property in your BLL that is int32
with a value that is of type string. I would suggest that you have the type
specified in all of your update parameter, .e.g
<asp:Parameter Name="PK_ID" Type="Int32" />

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Dabbler" wrote:
[color=blue]
> I'm getting the following error when I try and insert a row using FormView,
> ObjectDataSource and stored procedure. The form has 40+ columns on it and I'm
> not sure how to diagnose where the problem is, the data object class, the
> business class etc?
>
> Object of type 'System.Int32' cannot be converted to type 'System.String'.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information about
> the error and where it originated in the code.
>
> Exception Details: System.ArgumentException: Object of type 'System.Int32'
> cannot be converted to type 'System.String'.
>
> Source Error:
>
> An unhandled exception was generated during the execution of the current web
> request. Information regarding the origin and location of the exception can
> be identified using the exception stack trace below.
>
> Stack Trace:
>
> [ArgumentException: Object of type 'System.Int32' cannot be converted to
> type 'System.String'.]
> System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
> component, Object value) +357
> System.Web.UI.WebControls.ObjectDataSourceView.Bui ldDataObject(Type
> dataObjectType, IDictionary inputParameters) +237
> System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteInsert(IDictionary
> values) +270
> System.Web.UI.DataSourceView.Insert(IDictionary values,
> DataSourceViewOperationCallback callback) +72
> System.Web.UI.WebControls.FormView.HandleInsert(St ring commandArg,
> Boolean causesValidation) +388
> System.Web.UI.WebControls.FormView.HandleEvent(Eve ntArgs e, Boolean
> causesValidation, String validationGroup) +623
> System.Web.UI.WebControls.FormView.OnBubbleEvent(O bject source, EventArgs
> e) +95
> System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
> System.Web.UI.WebControls.FormViewRow.OnBubbleEven t(Object source,
> EventArgs e) +109
> 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
>
> Anu suggestions on how to diagnose this would be appreciated.
>
> Thanks much.[/color]
Dabbler
Guest
 
Posts: n/a
#3: Apr 18 '06

re: Object conversion error on insert with FormView and ObjectDataSour



Thanks much Phillip that did the trick, I had omitted some insert parameters
after revising the form.

"Phillip Williams" wrote:
[color=blue]
> I think that this line of the error message
> [System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
> component, Object value) +357] is telling you is that a type-casting error
> occured while attempting to set a public property in your BLL that is int32
> with a value that is of type string. I would suggest that you have the type
> specified in all of your update parameter, .e.g
> <asp:Parameter Name="PK_ID" Type="Int32" />
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Dabbler" wrote:
>[color=green]
> > I'm getting the following error when I try and insert a row using FormView,
> > ObjectDataSource and stored procedure. The form has 40+ columns on it and I'm
> > not sure how to diagnose where the problem is, the data object class, the
> > business class etc?
> >
> > Object of type 'System.Int32' cannot be converted to type 'System.String'.
> > Description: An unhandled exception occurred during the execution of the
> > current web request. Please review the stack trace for more information about
> > the error and where it originated in the code.
> >
> > Exception Details: System.ArgumentException: Object of type 'System.Int32'
> > cannot be converted to type 'System.String'.
> >
> > Source Error:
> >
> > An unhandled exception was generated during the execution of the current web
> > request. Information regarding the origin and location of the exception can
> > be identified using the exception stack trace below.
> >
> > Stack Trace:
> >
> > [ArgumentException: Object of type 'System.Int32' cannot be converted to
> > type 'System.String'.]
> > System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
> > component, Object value) +357
> > System.Web.UI.WebControls.ObjectDataSourceView.Bui ldDataObject(Type
> > dataObjectType, IDictionary inputParameters) +237
> > System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteInsert(IDictionary
> > values) +270
> > System.Web.UI.DataSourceView.Insert(IDictionary values,
> > DataSourceViewOperationCallback callback) +72
> > System.Web.UI.WebControls.FormView.HandleInsert(St ring commandArg,
> > Boolean causesValidation) +388
> > System.Web.UI.WebControls.FormView.HandleEvent(Eve ntArgs e, Boolean
> > causesValidation, String validationGroup) +623
> > System.Web.UI.WebControls.FormView.OnBubbleEvent(O bject source, EventArgs
> > e) +95
> > System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
> > System.Web.UI.WebControls.FormViewRow.OnBubbleEven t(Object source,
> > EventArgs e) +109
> > 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
> >
> > Anu suggestions on how to diagnose this would be appreciated.
> >
> > Thanks much.[/color][/color]
Closed Thread