可能很簡單的問題,但不想搞砸了。下面我查詢:在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字符串。 –