public void updateCustomer(BALCustomer obj)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = con;
        cmd.CommandText = "spUpdateCustomer";
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("@customerid", obj.CustomerID);
        cmd.Parameters.AddWithValue("@firstname", obj.FirstName);
        cmd.Parameters.AddWithValue("@lastname", obj.LastName);
        cmd.Parameters.AddWithValue("@address", obj.Address);
        cmd.Parameters.AddWithValue("@cityid", obj.CityID);
        cmd.Parameters.AddWithValue("@pincode", obj.Pincode);
        cmd.Parameters.AddWithValue("@mobile", obj.Mobile);
        cmd.Parameters.AddWithValue("@email", obj.Email);
        cmd.Parameters.AddWithValue("@gender", obj.Gender);
        cmd.Parameters.AddWithValue("@dob", obj.Dob);
        cmd.Parameters.AddWithValue("@loginid", obj.LoginID);


        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
    }
예제 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();

        c.id   = Convert.ToInt32(TextBox1.Text);
        c.name = TextBox2.Text;
        c.age  = TextBox3.Text;
        BALCustomer bc = new BALCustomer();
        int         i  = bc.insertCustomer(c);

        if (i > 0)
        {
            Label1.Text = "Success";
        }
        else
        {
            Label1.Text = "Failure";
        }
    }