复制代码 代码如下:
'把字符串转换成数据库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
'把字符串转换成数据库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
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“把字符串转换成数据库SQL语句格式”评论...