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 –