Answer the question
In order to leave comments, you need to log in
How to upload data from combobox to database (vs windows forms)?
command.Parameters.AddWithValue("LatName", textBox2.Text);
I understand how to add data from textboxes
How to do it for comboBox, where it is selected from several parameters?
And how to check for emptiness?
This didn't work:
command.Parameters.AddWithValue("Passport", comboBox2.SelectedValue);
command.Parameters.AddWithValue("Passport", comboBox2.SelectedItem);
Answer the question
In order to leave comments, you need to log in
1. If you have not selected any item in the comboBox, then the Selected* properties will be empty. use comboBox2.Items[0] / comboBox2.Items[1] to take the value from the list. in total in comboBox there will be comboBox2.Items.Count elements
2. check for "empty" value can be done like this comboBox2.Items[0] !=""
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question