TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nel
NA
716
1.1m
Problem with inserting the combobox selected value of type int
Feb 21 2012 8:26 AM
Hi,
I have a combobox and the value selected I want to use as a parameter. The field is of type Number in the access database, but when using the parameter for inserting the value in the database I get an error:
Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible'. and the code is:
int garbr = Convert.ToInt32(comboBox1.SelectedItem);
com.Parameters.AddWithValue("@Garbr", garbr);
if I write the code like:
com.Parameters.AddWithValue("@Garbr", comboBox1.SelectedItem);
I get an error:
"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
in : com.ExecuteNonQuery();
and the comboBox1.SelectedItem doesn't get a value, unlike the other parameters for which I also use combobox values, but of type text (they have the correct value when debugging)
Can anybody help me please?
Thanks
Reply
Answers (
4
)
Implementation of methods in an abstract class
Question about C# .aspx pages(Schedule problem)