AddQuotes = strReturn 结束功能 Yes you do need code - and you always need to check. I handle this byputting the code below in a module, then you can almost forget about -except for making sure you write: strSQL = "INSERT INTO ..."strSQL = strSQL & .....strSQL = strSQL & AddQuotes(strValue1, DoubleQuote)strSQL = strSQL & AddQuotes(strValue2, DoubleQuote)strSQL = strSQL & .....Option Compare DatabaseOption Explicit Public Enum QuoteTypeNoQuoteSingleQuoteDoubleQuoteEnd EnumPublic Function AddQuotes(strValue As String, Q As QuoteType) As String Dim strReturn As String Select Case Q Case QuoteType.SingleQuotestrReturn = Replace(strValue, "''", "''''")strReturn = "''" & strReturn & "''" Case QuoteType.DoubleQuotestrReturn = Replace(strValue, """", """""")strReturn = """" & strReturn & """" Case ElsestrReturn = strValue End Select AddQuotes = strReturn End Function 这篇关于SQL语法:如何使用双引号插入srting?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-24 15:54