在gridview中的"&"字符在后台获取时就变成了"&",这样导致查找数据库出错
如题
我在gridview中有个RC&LK的数据,在获取的时候变成了'RC&LK'
Dim selstr As String = "select * from workshop where workshop_name='" + dr.Cells(2).Text.ToString + "'"
此时的selstr的内容是:select * from workshop where workshop_name='RC&LK'
这是为什么呢?是编码转化出错吗?要怎么改正呢?
[解决办法]
Dim selstr As String = "select * from workshop where workshop_name='" + dr.Cells(2).Text.ToString().Replace("&","&") + "'"