how to get data from database ....
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
con.Open();
SqlCommand cmd = new SqlCommand("select id from customer where Name ='" +comboBox1.SelectedValue + "'", con);
int anuj1 = Convert.ToInt32(cmd.ExecuteScalar());
con.Close();
if (anuj1 > 0)
{
txtid.Text = Convert.ToString(anuj1);
}
}
catch
{
}