可能很简单的问题,但不想搞砸了。下面我查询:在sql串查询中添加额外的字符
Dim strCmd As String = ""
strCmd &= " UPDATE tbElemPics"
strCmd &= " SET PicturePath = Stuff(PicturePath, Charindex('/', PicturePath, Charindex('/', PicturePath)+1)"
strCmd &= " + 1, Charindex('/', PicturePath, Charindex('/', PicturePath, Charindex('/', PicturePath)+1)"
strCmd &= " + 1) - Charindex('/', PicturePath, Charindex('/', PicturePath) + 1) - 1, @newvalue)"
strCmd &= " WHERE Substring(PicturePath, Charindex('/', PicturePath, Charindex('/', PicturePath)+1)"
strCmd &= " + 1, Charindex('/', PicturePath, Charindex('/', PicturePath, Charindex('/', PicturePath)+1)"
strCmd &= " + 1) - Charindex('/', PicturePath, Charindex('/', PicturePath) + 1) - 1) = @oldvalue"
Using cmd As New SqlCommand(strCmd, con)
,现在我必须标记对此我路过那个地方= @oldvalue"
与N
所以例如= N'mysomeoldvalue'
字符串。我可以简单地做= [email protected]"
吗?我必须使用它,因为特定的字符。希望你知道我的意思
我强烈建议将此转换为存储过程,而不是像这样的一个巨大的SQL字符串。 –