The above error occur by the following lines
SqlCommand cmd1 = new SqlCommand("TCInsert");
cmd1.Parameters.AddWithValue("@adminNo", txtAdmissionno.Text);
cmd1.Parameters.AddWithValue("@nationality", ddlNationality.Text);
cmd1.Parameters.AddWithValue("@communityReligion", ddlCommunity.Text);
cmd1.Parameters.AddWithValue("@dateOfPromotion", txtpromotion.Text);
cmd1.Parameters.AddWithValue("@classToPromotion", ddlSemester.Text);
Download: eType1.com/f.php
string connectioString =@"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Projects\adoxA2Z db\adoxA2z.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
SqlConnection con = new SqlConnection(connectioString);
con.Open();
cmd1.Connection = con;
cmd1.CommandType = CommandType.StoredProcedure;
//cmd.Connection = con;
//con.Open();
cmd1.ExecuteNonQuery();
con.Close();