Hello I have an application with database. In right part of application I write my strings press add key and wirte these strings to LOCAL DATABASE then my Combobox show me which data is allready inserted in database. My question is how to insert strings (5strings) from that combobox to readOnly textBoxes in left part of Application? Thanks
This code show only one combobox Item, but if I have at least tree ones?
SqlCeCommand cmd = new SqlCeCommand("Select Name,Surname, Phone, Mail, Address from Persons", cn);
cmd.Parameters.AddWithValue("@Name", comboBox1.Text);
cmd.Parameters.AddWithValue("@Surname", comboBox1.Text);
cmd.Parameters.AddWithValue("@Phone", comboBox1.Text);
cmd.Parameters.AddWithValue("@Mail", comboBox1.Text);
cmd.Parameters.AddWithValue("@Address", comboBox1.Text);
cn.Open();
SqlCeDataReader read = cmd.ExecuteReader();
if (read.Read())
{
textBox2.Text = Convert.ToString(read[0]);
textBox3.Text = Convert.ToString(read[1]);
textBox4.Text = Convert.ToString(read[2]);
textBox5.Text = Convert.ToString(read[3]);
textBox6.Text = Convert.ToString(read[4]);
} cn.Close();
P.S. From SQL Server forum I was sent here.