What is the fastest way in VB to transfer an ADO recordset to a SQLite .db
file? I am using the dll from TerraInformatica, SQLiteDb.dll.

This is what I have now:

   Set oSQLConn = New SQLiteDb.Connection

   With oSQLConn
      .ConnectionString = "Data Source=" & strReadSQLiteDB
      .Open
      .Execute "PRAGMA synchronous=off;", , slExecuteNoRecords
      .Execute "PRAGMA encoding='UTF-8';", , slExecuteNoRecords

      .Execute "CREATE TABLE [READCODE] " & _
               "([SUBJECT_TYPE] TEXT, [READ_CODE] TEXT, " & _
               "[TERM30] TEXT, [TERM60] TEXT)"
               
      LC = rs.Fields.Count - 1
      
      .BeginTrans
      
      While Not rs.EOF

         For i = 0 To LC
            If InStr(1, rs(i), Chr(34), vbBinaryCompare) > 0 Then
               strTemp = Replace(rs(i), Chr(34), "", 1, -1, vbBinaryCompare)
            Else
               strTemp = rs(i)
            End If
            If InStr(1, strTemp, Chr(44), vbBinaryCompare) > 0 Then
               strTemp = Replace(strTemp, Chr(44), "", 1, -1,
vbBinaryCompare)
            End If
            If i = 0 Then
               strValues = Chr(34) & strTemp & Chr(34)
            Else
               strValues = strValues & "," & Chr(34) & strTemp & Chr(34)
            End If
         Next

         .Execute "INSERT INTO READCODE " & _
                  "(SUBJECT_TYPE, READ_CODE, TERM30, TERM60) " & _
                  "VALUES (" & strValues & ")"
         rs.MoveNext
      Wend

      rs.Close

      .CommitTrans
   End With

I am not sure about the PRAGMA commands and the oSQLConn.BeginTrans and
oSQLConn.CommitTrans



RBS



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to