在xml中含有特殊字符%的sql语句读取失败,如下是一个范例:
<xpath>count(//stack/stackPoint[method="-<![CDATA[ExecuteNonQuery]]>"andparameters/va...
<xpath>
count(//stack/stackPoint[method="
- <![CDATA[ ExecuteNonQuery
]]>
" and parameters/variable[name="
- <![CDATA[ cmdText
]]>
" and value="
- <![CDATA[ INSERT INTO BookAuthor(ItemId, AuthorId) VALUES('113', '1')
]]>
"]])=1
</xpath>
需要完成的是:
<xpath>
count(//stack/stackPoint[method="
- <![CDATA[ ExecuteScalar
]]>
" and parameters/variable[name="
- <![CDATA[ cmdText
]]>
" and value="
- <![CDATA[ Select Count(A.Name) From Authors AS A, BookAuthor AS BA, Books AS B Where A.PKId = BA.AuthorId And BA.ItemId = B.ItemId And A.Name Like '%B%'
]]>
"]])=1
</xpath>
初步判断因为语句中包含: Like '%B%' 导致读取失败,
目前尝试过并且均失败的方法有:
1. Like N'%B%'
2. Like '[%B%]'
3. Like '[%]B[%]'
请高手指导。。。。。。。。。。。。。。。。。。。
Sorry,我没讲清楚,这个只是作为一段字符串来处理,也就是经过转化后,还是要是这个样子: Like '%B%'
,不能改sql语句。。。。。。
呃,没有解答,算了。。。。。 展开
count(//stack/stackPoint[method="
- <![CDATA[ ExecuteNonQuery
]]>
" and parameters/variable[name="
- <![CDATA[ cmdText
]]>
" and value="
- <![CDATA[ INSERT INTO BookAuthor(ItemId, AuthorId) VALUES('113', '1')
]]>
"]])=1
</xpath>
需要完成的是:
<xpath>
count(//stack/stackPoint[method="
- <![CDATA[ ExecuteScalar
]]>
" and parameters/variable[name="
- <![CDATA[ cmdText
]]>
" and value="
- <![CDATA[ Select Count(A.Name) From Authors AS A, BookAuthor AS BA, Books AS B Where A.PKId = BA.AuthorId And BA.ItemId = B.ItemId And A.Name Like '%B%'
]]>
"]])=1
</xpath>
初步判断因为语句中包含: Like '%B%' 导致读取失败,
目前尝试过并且均失败的方法有:
1. Like N'%B%'
2. Like '[%B%]'
3. Like '[%]B[%]'
请高手指导。。。。。。。。。。。。。。。。。。。
Sorry,我没讲清楚,这个只是作为一段字符串来处理,也就是经过转化后,还是要是这个样子: Like '%B%'
,不能改sql语句。。。。。。
呃,没有解答,算了。。。。。 展开
2个回答
展开全部
改下SQL????
Select Count(A.Name) From Authors AS A, BookAuthor AS BA, Books AS B Where A.PKId = BA.AuthorId And BA.ItemId = B.ItemId And instr(A.Name 'B') >0
Select Count(A.Name) From Authors AS A, BookAuthor AS BA, Books AS B Where A.PKId = BA.AuthorId And BA.ItemId = B.ItemId And instr(A.Name 'B') >0
更多追问追答
追问
Sorry,我没讲清楚,这个只是作为一段字符串来处理,也就是经过转化后,还是要是这个样子: Like '%B%'
追答
用神马工具解析的XML?
2011-11-11
展开全部
Like '%%B%%'
也不行么?
或Like '\%B\%'
也不行么?
或Like '\%B\%'
追问
呃,试了试,可惜都不行。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询