Update buildinsertSQL to comment single quotes

This commit is contained in:
fleetside72 2017-04-11 11:24:28 -04:00 committed by GitHub
parent 730b2667d3
commit 99a5318f4d

View File

@ -1862,7 +1862,7 @@ Function json_concat(list As range) As String
End Function End Function
Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, trim As Boolean, start As Long, ending As Long, ParamArray ftype()) As String Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, target As String, trim As Boolean, start As Long, ending As Long, ParamArray ftype()) As String
Dim i As Long Dim i As Long
@ -1870,7 +1870,7 @@ Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, tri
Dim sql As String Dim sql As String
Dim rec As String Dim rec As String
sql = "INSERT INTO " & Target & " VALUES " & vbCrLf sql = "INSERT INTO " & target & " VALUES " & vbCrLf
For i = start To ending For i = start To ending
rec = "" rec = ""
If i <> start Then sql = sql & "," & vbCrLf If i <> start Then sql = sql & "," & vbCrLf
@ -1881,13 +1881,13 @@ Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, tri
If tbl(j, i) = "" Then If tbl(j, i) = "" Then
rec = rec & "NULL" rec = rec & "NULL"
Else Else
rec = rec & tbl(j, i) rec = rec & Replace(tbl(j, i), "'", "''")
End If End If
Else Else
If trim Then If trim Then
rec = rec & "'" & LTrim(RTrim(tbl(j, i))) & "'" rec = rec & "'" & LTrim(RTrim(Replace(tbl(j, i), "'", "''"))) & "'"
Else Else
rec = rec & "'" & tbl(j, i) & "'" rec = rec & "'" & Replace(tbl(j, i), "'", "''") & "'"
End If End If
End If End If
Next j Next j