|
Sql ignores single quote
|
|
02-19-2010, 07:40 PM
Post: #1
|
|||
|
|||
|
Sql ignores single quote
Hi Guys,
I found a weried problem that when I doing full-text search in SQL Server(SQL Server 2008 Express Edition) using C#(LINQ) and if I passed in a search creteria with a single quote, it can't get any result back.But if I tried to execute the same SQL statement in SQL Server Managent Studio, it returns result...It's so absurd.. I replaced single quote in search creteria with two single quotes. replaced double quote with two double quotes. SQL: SELECT * FROM myTable WHERE (CONTAINS(myTable.*, '"xx''xx"') Work arround: I tried to set stoplist to off, but the result WAS the same( no results). I tried to execute the same application in another two PCs (PC-B,PC-C, SQL Server 2008 Developer, and SQL 2005 Express), the application works pretty good. Can any one tell me the reason. |
|||
|
02-19-2010, 08:04 PM
Post: #2
|
|||
|
|||
|
RE: Sql ignores single quote
If you pass the parameter directly to the query it may result in error when the parameter contains single quotes and it will be one of the security issues (the single quote is a special character in SQL server). So it would be better if you use stored procedures.
|
|||
|
« Next Oldest | Next Newest »
|




