private void button2_Click(object sender, EventArgs e)
{
int CustomerId = 0;
SqlConnection con = new SqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
SqlCommand com = new SqlCommand("select max(CustomerId) FROM DEVI", con);
if (com.ExecuteScalar().ToString() == "")
{
CustomerId = 0;
}
else
{
CustomerId = int.Parse(com.ExecuteScalar().ToString());
}
if (CustomerId > 0)
{
CustomerId = CustomerId + 1;
}
else
{
CustomerId = 1;
}
here i need to get the id on textbox1 .how to get it in text box
MessageBox.Show("Id Created");
}


Khargesh RajputRank #616 · 3.9K reputationPosted Apr 24, 2015, 9:19 PM EDT
Durga VelusamyRank #4,868 · 321 reputationPosted Apr 24, 2015, 10:14 PM EDT
Gowtham RajamanickamRank #57 · 29K reputationPosted Apr 24, 2015, 10:12 PM EDT