-6

如果我没有在类型前添加“ WHERE ”,则会收到“类型”错误

string sql = "UPDATE Resource SET " + "location='" + location + "'" + "WHERE levelNo='" + levelNo + "'" + "Type='" + type + "'" + " Abr='"+ abr + "'" + " Description='" + description + "'" + " Capacity='" +capacity +"'" + " Detail='" + detail + "'";

但如果我把它说出来,我会得到“ WHERE ”的错误

string sql = "UPDATE Resource SET " + "location='" + location + "'" + "WHERE levelNo='" + levelNo + "'" + "**WHERE** Type='" + type + "'" + " Abr='"+ abr + "'" + " Description='" + description + "'" + " Capacity='" +capacity +"'" + " Detail='" + detail + "'";
4

2 回答 2

4

您需要AND在附加条件之间使用 s,而不是附加WHERE条款

于 2013-06-06T16:50:54.673 回答
2

"WHERE levelNo='" + levelNo + "' AND " + "Type='" + type + "'"

于 2013-06-06T16:51:16.173 回答