Sir I need some urgent help. M currently doing a project on hotel management system in C# using visual studio 2005 and SQl server 2005. The main problem m facing ri8 now is m unable to ADD and DELETE data to the server in the windows form. M alredy connect to my database.
So here is the code for Add button:
private void button1_Click(object sender, EventArgs e)
{
if ((textBox1.Text == "") || (textBox2.Text == "") || (textBox3.Text == "") || (comboBox1.Text == "") || (textBox4.Text == "") || (textBox5.Text == "") || (textBox6.Text == ""))
{
MessageBox.Show("Some of the fields is empty....\nCheck it again");
return;
}
else
{
SqlConnection savecon = new SqlConnection(constring);
savecon.Open();
SqlCommand savecom = new SqlCommand("insert into CheckIn_Receipt VALUES( '" + textBox1.Text + "', '" + textBox2.Text + "','" + textBox3.Text + "','" + comboBox1.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + ")", savecon);
savecom.ExecuteNonQuery();
savecon.Close();
}
}