I'm trying to update a column in SQL but I get this Error..
Code:
SqlConnection cn = new SqlConnection("CONNECTION STRING");
SqlCommand com = new SqlCommand("update details set Available='Yes' where License='@a'", cn);
com.Parameters.AddWithValue("@a", num);
cn.Open();
com.ExecuteNonQuery();
cn.Close();
Remove the single quotes from around the @a
SqlConnection cn = new SqlConnection("CONNECTION STRING");
SqlCommand com = new SqlCommand("update details set Available='Yes' where License=@a", cn);
com.Parameters.AddWithValue("@a", num);
cn.Open();
com.ExecuteNonQuery();
cn.Close();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.