0
我無法弄清楚問題在這裏,因爲附加信息返回爲:'(')附近的語法不正確。我需要新鮮的眼睛在這,我不能看到錯誤System.Data.SqlClient.SqlException發生在System.Data.dll中(語法不正確)
這裏是我的代碼,我嘗試更新的信息,所選擇的Owner_ID
System.Data.SqlClient.SqlCommand command = new SqlCommand("UPDATE OwnerTable SET (Owner_ID, Owner_Fname, Owner_Lname, Owner_HouseNo, Owner_Street, Owner_County, Owner_PostCode, Owner_Tele, Owner_Email) VALUES (@OwnerID, @OwnerFName, @OwnerLName, @OwnerHouseNo, @OwnerStreet, @OwnerCounty, @OwnerPostCode, @OwnerTele, @OwnerEmail) WHERE Owner_ID = @OwnerID", connection);
command.CommandType = CommandType.Text;
command.Connection = connection;
command.Parameters.AddWithValue("@OwnerID", CB_OWNER_ID.GetItemText(CB_OWNER_ID.SelectedItem));
command.Parameters.AddWithValue("@OwnerFName", TXT_OWNER_FNAME.Text);
command.Parameters.AddWithValue("@OwnerLName", TXT_OWNER_LNAME.Text);
command.Parameters.AddWithValue("@OwnerHouseNo", TXT_OWNER_HOUSENO.Text);
command.Parameters.AddWithValue("@OwnerStreet", TXT_OWNER_STREET.Text);
command.Parameters.AddWithValue("@OwnerCounty", TXT_OWNER_COUNTY.Text);
command.Parameters.AddWithValue("@OwnerPostCode", TXT_OWNER_POSTCODE.Text);
command.Parameters.AddWithValue("@OwnerTele", TXT_OWNER_TELE.Text);
command.Parameters.AddWithValue("@OwnerEmail", TXT_OWNER_EMAIL.Text);
它是'set a = b,c = d'。 –
@PatrickHofman,ANSI SQL具有'set(c1,c2)=(v1,v2)',特徵T641,「多列分配」。 (至少由一些供應商支持) – jarlh
但OP使用'values',這是不正確的@jarlh –