Hi , I need a help on the below error . I am trying to insert values into table and also want to update Gridview simultaneously.
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=SONY-VAIO\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=True");
SqlCommand cmd = new SqlCommand("insert into Employe(Employee_Name,Gender,Mobile,Address,ity,State) values(@Employee_Name,@Gender,@Mobile,@Address,@City,@State",con);
con.Open();
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Employee_Name",txtEmpName.Text.ToString());
cmd.Parameters.AddWithValue("@Gender",RdGender.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@Mobile",txtMobile.Text.ToString());
cmd.Parameters.AddWithValue("@Address",txtAddress.Text.ToString());
cmd.Parameters.AddWithValue("@City",ddlCity.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@State",ddlState.SelectedValue.ToString());
int result = cmd.ExecuteNonQuery();
if (result > 0
{
FillGridView();
}