SqlConnection objCon = new SqlConnection(@"Data Source=MIS-PC;Initial Catalog=projecthotel;Integrated Security=True");
SqlCommand objCmd = new SqlCommand();
objCmd.Connection = objCon;
string query = "insert into Reservation values('" + textBox1.Text + "', '" + comboBox2.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox15.Text + "','" + comboBox7.Text + "','" + comboBox8.Text + "','" + comboBox9.Text + "','" + textBox25.Text + "','" + textBox17.Text + "','" + textBox18.Text + "','" + textBox20.Text + "','" + textBox21.Text + "')";
objCmd.CommandText = query;
objCon.Open();
int j = objCmd.ExecuteNonQuery();
if (j > 0)
{
MessageBox.Show("Record Inserted","www.codingresolved.com");
dataGridView3.Rows.Clear();
}
objCon.Close();
Form1 form1 = new Form1();
form1.Show();
}