i everybody,

I need some help with my project.

I'm trying to retrieve some data from a combo box on which i used the "data bound item task" so I can select data from a table of my database.

the problem I'm having is that when i try to save into another table the selected item from the combo box.....either I get an error "failed to convert parameter value from a DataRowView to a string" or it just save the field of the table in blank

here is the code were i have the problem

cmd.Parameters("@CODIGO").Value = CODIGOComboBox.SelectedText.ToString   ' --->this way it save the field in blank
cmd.Parameters("@NOMBRE_CURSO").Value = NOMBRE_CURSOComboBox.SelectedItem.ToString  '---> this way it save into the field  "System.Data.DataRowView"  & if I don't use                                                                                                                                                             the .ToString i get the error above.
cmd.Parameters("@CODIGO").Value = CODIGOComboBox.SelectedText.ToString   ' --->this way it save the field in blank
cmd.Parameters("@NOMBRE_CURSO").Value = NOMBRE_CURSOComboBox.SelectedItem.ToString  '---> this way it save into the field  "System.Data.DataRowView"  & if I don't use                                                                                                                                                             the .ToString i get the error above.

The problem is that your data bound "Value" always expects a string.

Perhaps you are intending to use the "ItemData" property of your combo box.

Hope helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.