Can anyone help me in the following code I am facing a error.after SqlDataReader reader = cmd.ExecuteReader();in the following code.
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=STUDENT-1D40FC5\\SQLEXPRESS; Initial Catalog=SubscriptionMGNT; Integrated Security=SSPI");
string query = "insert into newsubscription(name,address,post,taluk,district,pin,mobile,tel,state,country,bname,bcode,yrs,issues ,start,end,cheque,bank,ddate,amt)values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "','" + comboBox1.Text + "','" + textBox11.Text + "','" + comboBox3.Text + "','" + textBox12.Text + "','" + comboBox4.Text + "','"+comboBox2.Text+"','"+textBox13.Text+"','"+textBox14.Text+"','"+comboBox5.Text+"','"+textBox15. Text+"')";
SqlCommand cmd = new SqlCommand(query,con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
MessageBox.Show("A New Subscription Has Been Created");
while (reader.Read())
{
}
reader.Close();
}
Bookmarks