Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (db = new DataClasses1DataContext())
            {
                CustomerDetail cc = new CustomerDetail()
                {
                    Cus_id          = textBox1.Text,
                    Cus_Name        = textBox2.Text,
                    Cus_Address     = textBox3.Text,
                    Cus_Phone       = textBox4.Text,
                    Cus_dateofbirth = maskedTextBox1.Text,
                    Cus_Email       = textBox6.Text
                };
                //db.CustomerDetails.InsertOnSubmit(cc);
            }
            //record();
            try
            {
                int    id      = Convert.ToInt32(textBox1.Text);
                string name    = textBox2.Text;
                string address = textBox3.Text;
                string phone   = textBox4.Text;
                string dob     = maskedTextBox1.Text;
                string email   = textBox6.Text;


                SqlConnection conn  = new SqlConnection(connection);
                string        query = string.Format("insert into customer1 values({0},'{1}','{2}','{3}','{4}','{5}')", id, name, address, phone, dob, email);
                SqlCommand    cmd   = new SqlCommand(query, conn);
                conn.Open();
                int result = cmd.ExecuteNonQuery();

                conn.Close();

                MessageBox.Show("Sucessfully Ragestered");


                clear();
            }
            catch (Exception)
            {
                MessageBox.Show("Field Required Fill the form ");
                clear();
            }
        }
 partial void DeleteCustomerDetail(CustomerDetail instance);
 partial void UpdateCustomerDetail(CustomerDetail instance);
 partial void InsertCustomerDetail(CustomerDetail instance);