[Daily] sucker - forget the loss caused by the single quotation marks Sa hours of time when stitching SQL statement

string sql = "update Admin set authority = '"+ context.Request["auth"].ToString()  + "' where loginname='" + context.Request["loginname"].ToString() + "'";

When stitching SQL, single and double quotation marks are often easy to see feel dizzy, or accidentally miss a single quote.

Although the field is defined varchar, but when the data for the update of its pure digital pre-0 is always lost, baffled.


Repeated attempts, and even update will go wrong in the SMMS there, suddenly found the last.

update admin set authority=0010100 where id=17

Oh Shedd finally found out that the SQL statement forgot single quotation marks! !

Read:

update admin set authority='0010100' where id=17

It can be.

Summary: sps or use a good point ...... fight daily Shabi plush string ...... .......

Guess you like

Origin www.cnblogs.com/imPedro/p/11373697.html