private void buttonEcllipse1_Click(object sender, EventArgs e) { DateTime datetime = Convert.ToDateTime(cmbreg_date.Text); string cmd_query = "INSERT INTO user_tbl values('" + txtuname.Text + "','" + txtfname.Text + "','" + txtlname.Text + "','" + txtemail.Text + "','" + txtpnumber.Text + "','" + txtaddress.Text + "','" + txtpword.Text + "','" + datetime + "','" + cmbcombo.Text + "' )"; con = new SqlConnection(ConnectionString); if (txtpword.Text != txtcpword.Text) { MessageBox.Show("The passwords do not match", "please try again!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtcpword.Focus(); } else { con.Open(); //cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = cmd_query;//"INSERT INTO user_tbl values('" + txtuname.Text + "','" + txtfname.Text + "','" + txtlname.Text + ",'" + txtemail.Text + "','" + txtpnumber.Text + "','" + txtaddress.Text + "','" + txtpword.Text + "','" + cmbreg_date.Text + "' )"; ; cmd.ExecuteNonQuery(); con.Close(); //string msg = MessageBox.Show("record inserted successfully"); //reset controls txtuname.Text = ""; txtfname.Text = ""; txtlname.Text = ""; txtemail.Text = ""; txtpnumber.Text = ""; txtaddress.Text = ""; txtpword.Text = ""; txtcpword.Text = ""; cmbreg_date.Text = ""; this.Hide(); login lg = new login(); lg.Show(); } }