Durga Velusamy

Durga Velusamy

  • NA
  • 318
  • 109.1k

here ineed to get the id on txtbox1,how to get it in txtbox

Apr 25 2015 1:16 AM

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");

 

        }


Answers (3)