Reputation: 13902
I'm making an Insert query to add a row to a table.
I'm currently using a library called sqlstring
: SqlString.escape(str);
When str
has a single quote in it, like "123'456"
, the above function outputs this: "123\'456"
. My mssql server doesn't seem to like that.
{
"info": {
"name": "ERROR",
"event": "errorMessage",
"number": 105,
"state": 1,
"class": 15,
"message": "Unclosed quotation mark after the character string ')'.",
"serverName": "CALLIOPE",
"procName": "",
"lineNumber": 3
}
}
Wondering if you guys have any advice about how I can escape this string properly for mssql
Upvotes: 1
Views: 940
Reputation: 13902
the library i was using above is for MySql mainly.
For MSSQL, there's this library instead, although that has its own problem -- escaping double quotes, "
(I'm pretty sure the problem is that mssql doesn't NEED any double-quote escaping, so it's just unecessary)
Upvotes: 1