Below is a code and Visual Studio is raising error that there is syntax error near WHERE.
SqlCommand cmd2 = new SqlCommand("insert into courses(t_id_fk) values('" + valu3 + "') where c_id=@dr1 ", con);
cmd2.CommandType = CommandType.Text;
cmd2.Parameters.Add("@dr1", SqlDbType.Int);
cmd2.Parameters["@dr1"].Value = d1;
cmd2.ExecuteNonQuery();
con.Close();