开发者

Insert string with comma into varchar?

I'm trying to insert a string that contains a comma into a varchar in vb.net. How do I make the insert statement I'm开发者_StackOverflow building understand that I want "X,Y" to be in the varchar and not X in the varchar and Y in the next column?


Use parametised queries:

Dim cmd as new sqlcommand("INSERT INTO TableA (ColA) VALUES (@ColA)", Conn)
cmd.parameters.add("@ColA",sqldbtype.nvarchar).value = "X,Y"
cmd.executenonquery()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜