I made a small website and reported an error when updating the table. There was a syntax error near the update statement. After searching for the Internet for half a day, I asked other people to know where the error was,
Paste the code.
Stringbuilder strsqlinset = new stringbuilder (); // The using system. Text namespace is required.
Strsqlinset. append ("Update styleinfo set [style] =" + styleinfo. style + ", [styleid] =" + styleinfo. styleid + ", [title] =" + styleinfo. title + ", [content] =" + styleinfo. content + "where id =" + styleinfo. ID + "");
If this is the case, an error will be reported because single quotation marks must be added before the text fields in the Access Table and numeric fields are not required. Therefore, single quotation marks ('field name') must be placed after each set field '), in addition, to define the field name and access reserved words, or keywords, for the sake of insurance, use [] to enclose the field name, such as [ID].
The correct code is as follows:
Strsqlinset. append ("Update styleinfo set [style] = '" + styleinfo. style + "', [styleid] =" + styleinfo. styleid + ", [title] = '" + styleinfo. title + "', [content] ='" + styleinfo. content + "'where [ID] =" + styleinfo. ID + "");
I can't tell if this is the case if the technology is limited.