把字符串转换成数据库SQL语句格式
代码如下:
'把字符串转换成数据库SQL语句格式 '------------------------------------------------- Function AllStr2Database(str,strType) Dim strTemp:strTemp=str Select Case strType Case "" Case "num" strTemp = Clng(strTemp) Case "string" '无Trim strTemp = Replace(strTemp, "'", "''") Case "str_br" '无Trim,把回车转换为<br>,一般用于多行文本输入 strTemp = Replace(Replace(strTemp, "'", "''"), VbCrlf, "<br>") Case "str_trim" 'Trim strTemp = Replace(Trim(strTemp), "'", "''") Case "nums" strTemp = Trim(strTemp) strTemp = Replace(strTemp, ")", "") strTemp = Replace(strTemp, "(", "") strTemp = Replace(strTemp, "'", "") strTemp = Replace(strTemp, ";", "") strTemp = Replace(strTemp, " ", "") strTemp = Replace(strTemp, "or", "") strTemp = Replace(strTemp, "and", "") strTemp = Replace(strTemp, "delete", "") strTemp = Replace(strTemp, "select", "") strTemp = Replace(strTemp, "exec", "") strTemp = Replace(strTemp, "update", "") strTemp = Replace(strTemp, "select", "") Case "strings" Case Else End Select AllStr2Database = strTemp End Function
相关推荐
CoderToy 2020-11-16
技术之博大精深 2020-10-16
emmm00 2020-11-17
bianruifeng 2020-11-16
云中舞步 2020-11-12
世樹 2020-11-11
暗夜之城 2020-11-11
张荣珍 2020-11-12
amienshxq 2020-11-14
ASoc 2020-11-14
yungpheng 2020-10-19
loveyouluobin 2020-09-29
尘封飞扬 2020-09-29
Coder技术文摘 2020-09-29
lbyd0 2020-11-17
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09