主頁 > 知識庫 > 把字符串轉(zhuǎn)換成數(shù)據(jù)庫SQL語句格式

把字符串轉(zhuǎn)換成數(shù)據(jù)庫SQL語句格式

熱門標(biāo)簽:阿里云 電子圍欄 Mysql連接數(shù)設(shè)置 銀行業(yè)務(wù) 服務(wù)器配置 Linux服務(wù)器 科大訊飛語音識別系統(tǒng) 團(tuán)購網(wǎng)站
復(fù)制代碼 代碼如下:

'把字符串轉(zhuǎn)換成數(shù)據(jù)庫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,把回車轉(zhuǎn)換為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

標(biāo)簽:萍鄉(xiāng) 大理 廣元 衡水 衢州 蚌埠 棗莊 江蘇

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《把字符串轉(zhuǎn)換成數(shù)據(jù)庫SQL語句格式》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266