我試圖插入SQL數據庫,但是我不斷收到一個錯誤錯誤插入查詢
下面是提到的查詢:
str2 = "Insert into [Snaps](Loc_city,Loc_state,Loc_country,Edu_Hist1,Work_Hist1) values (Loc_city= ' " + soap.data[i1].current_location.city.ToString() + "', Loc_state='" + soap.data[i1].current_location.state.ToString() + "', Loc_country='" + soap.data[i1].current_location.country.ToString() + "',Edu_Hist1='" + soap.data[i1].education_history[0].name.ToString() + "', Work_Hist1 ='" + soap.data[i1].education_history[0].school_type.ToString()+"')";
cmd = new SqlCommand(str2,con);
cmd.ExecuteNonQuery();
請幫
是否要更新現有字段或在表中插入新字段?你的sql是完全錯誤的。 – 2012-02-20 15:57:32
我插入不更新,因爲你可以看到 – vini 2012-02-21 02:18:47
布賴恩的答案就是我所說的。在更新語句中只需要'Loc_city = ...'。 – 2012-02-21 11:16:14