473,545 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object conversion error on insert with FormView and ObjectDataSour

I'm getting the following error when I try and insert a row using FormView,
ObjectDataSourc e 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.Argument Exception: 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:

[ArgumentExcepti on: Object of type 'System.Int32' cannot be converted to
type 'System.String' .]
System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect
component, Object value) +357
System.Web.UI.W ebControls.Obje ctDataSourceVie w.BuildDataObje ct(Type
dataObjectType, IDictionary inputParameters ) +237
System.Web.UI.W ebControls.Obje ctDataSourceVie w.ExecuteInsert (IDictionary
values) +270
System.Web.UI.D ataSourceView.I nsert(IDictiona ry values,
DataSourceViewO perationCallbac k callback) +72
System.Web.UI.W ebControls.Form View.HandleInse rt(String commandArg,
Boolean causesValidatio n) +388
System.Web.UI.W ebControls.Form View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +623
System.Web.UI.W ebControls.Form View.OnBubbleEv ent(Object source, EventArgs
e) +95
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Form ViewRow.OnBubbl eEvent(Object source,
EventArgs e) +109
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e) +115
System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng
eventArgument) +163

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +174
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102

Anu suggestions on how to diagnose this would be appreciated.

Thanks much.
Apr 17 '06 #1
2 1854
I think that this line of the error message
[System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect
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:Paramete r Name="PK_ID" Type="Int32" />

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
I'm getting the following error when I try and insert a row using FormView,
ObjectDataSourc e 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.Argument Exception: 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:

[ArgumentExcepti on: Object of type 'System.Int32' cannot be converted to
type 'System.String' .]
System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect
component, Object value) +357
System.Web.UI.W ebControls.Obje ctDataSourceVie w.BuildDataObje ct(Type
dataObjectType, IDictionary inputParameters ) +237
System.Web.UI.W ebControls.Obje ctDataSourceVie w.ExecuteInsert (IDictionary
values) +270
System.Web.UI.D ataSourceView.I nsert(IDictiona ry values,
DataSourceViewO perationCallbac k callback) +72
System.Web.UI.W ebControls.Form View.HandleInse rt(String commandArg,
Boolean causesValidatio n) +388
System.Web.UI.W ebControls.Form View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +623
System.Web.UI.W ebControls.Form View.OnBubbleEv ent(Object source, EventArgs
e) +95
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Form ViewRow.OnBubbl eEvent(Object source,
EventArgs e) +109
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e) +115
System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng
eventArgument) +163

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +174
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102

Anu suggestions on how to diagnose this would be appreciated.

Thanks much.

Apr 17 '06 #2

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

"Phillip Williams" wrote:
I think that this line of the error message
[System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect
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:Paramete r Name="PK_ID" Type="Int32" />

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
I'm getting the following error when I try and insert a row using FormView,
ObjectDataSourc e 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.Argument Exception: 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:

[ArgumentExcepti on: Object of type 'System.Int32' cannot be converted to
type 'System.String' .]
System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect
component, Object value) +357
System.Web.UI.W ebControls.Obje ctDataSourceVie w.BuildDataObje ct(Type
dataObjectType, IDictionary inputParameters ) +237
System.Web.UI.W ebControls.Obje ctDataSourceVie w.ExecuteInsert (IDictionary
values) +270
System.Web.UI.D ataSourceView.I nsert(IDictiona ry values,
DataSourceViewO perationCallbac k callback) +72
System.Web.UI.W ebControls.Form View.HandleInse rt(String commandArg,
Boolean causesValidatio n) +388
System.Web.UI.W ebControls.Form View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +623
System.Web.UI.W ebControls.Form View.OnBubbleEv ent(Object source, EventArgs
e) +95
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Form ViewRow.OnBubbl eEvent(Object source,
EventArgs e) +109
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e) +115
System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng
eventArgument) +163

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +174
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102

Anu suggestions on how to diagnose this would be appreciated.

Thanks much.

Apr 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1035
by: Stuart Ferguson | last post by:
I am currently experimenting with the FormView control using an ObjectDataSource, i have got the select section of the form view control working fine however when it comes to using the formview to insert a record i cant see any way to populate the parameteres in the insert method, how do you set which field in the FormView relates to which...
7
4339
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the sqldatasource of the formview. If i put this textboxes outside the table everything works well, but as soon as i put them inside the table (in order to...
1
1566
by: Chris | last post by:
I have a formview based on an SQL Data Source see below. I have a formview bound to it. The item insert template has a command button with a command name insert. When I press it the insert doesn't take place in the database. What obvious thing am I doing wrong!!? Regards, Chris. Could it be something to do with the FormView1_ItemInserted...
0
1599
by: Prakash | last post by:
Hi all, I am getting an error message "Object reference not set to an instance of an object." when i try to read values that are inside FormView control. I am just trying to read the values displayed in a formview control to be used elsewhere in the same page. Below is the code that i've used in the aspx page, <asp:FormView...
2
2312
by: Bishop | last post by:
ASP.NET 2.0 XP SP2 IIS W/IE7 Master Page I use the wizard to create the FormView and Datasource and set the default view to Insert. When I try to use the page, and click the insert link, I get a 404 error. Any idea why I would get this? This is all using the wizard, including creating the SQL queries.
6
14440
by: AG | last post by:
ASP.NET 2.0 aspx page with a FormView bound to an ObjectDataSource to view, add and edit records. Can anyone point me to a sample of how to retain the user entered control values when an insert fails? In other words, when inserting a new record, user enters data in the controls, but the insert fails. When the page posts back all the...
8
11958
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property which is not a string, for example a custom type Address which contains properties such as StreetAddress, City, County, Country etc how do i bind to...
0
1352
by: Enigma Boy | last post by:
Hi Folks, If I bind my formview to a dataset business object all works well, but when I bind it to my own custom class business object it refreshes on each postback. I am trying to do an insert and instead of returning bool from the insert method I am returning an int which is the ID of the newly added record. -- <a...
0
2334
by: yosri2005 | last post by:
Hello, I'm sure many of you have seen the error message in the subject. I found quiet a few posts on the web regarding this issue, but the ones I saw mainly tackle this issue when you have a drop-down list depending on another drop-down list within a form view. This is not what I'm trying to do, so I didn't know how to apply the solutions I...
0
7416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7442
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.