I use this code:
for a little file work well but with a big file have in Res out of memory...
Have a suggestion?
Rich (BB code):
Option Explicit
Public Function QuickRead(FName As String) As Variant
Dim I As Long
Dim RES As String
Dim L As Long
Dim V As Variant
I = FreeFile
L = FileLen(FName)
RES = Space(L)
Open FName For Binary Access Read As #I
Get #I, , RES
Close I
QuickRead = Split(RES, vbLf)
End Function
Public Sub FAST_READ()
Dim strFilePathName As String
strFilePathName = "C:\Lavori_Vb6\IMPORT_STRADE\CSVFILE\" & NOMEFILE
Dim strFileLine As String, RIGA As String, CF As String, ISTAT As String, STRADA As String, CIVICO As String, IDSTR As String
Dim V As Variant
Dim I As Long
V = QuickRead(strFilePathName)
For I = 1 To UBound(V) - 1
DoEvents
RIGA = V(I)
IDSTR = Split(RIGA, ";")(2)
RSS.Seek IDSTR, adSeekFirstEQ
If RSS.EOF Then
CF = Split(RIGA, ";")(0)
ISTAT = Split(RIGA, ";")(1)
IDSTR = Split(RIGA, ";")(2)
STRADA = Split(RIGA, ";")(4)
SQL = "INSERT INTO STRADE (CF, ISTAT, ID, STRADA, AGG) VALUES ('" & CF & "', '" & ISTAT & "','" & IDSTR & "','" & Replace(STRADA, "'", "''") & "','" & Date & "')"
CON.Execute (SQL)
'CIVICO = Split(RIGA, ";")(10)
End If
Next I
End Sub
for a little file work well but with a big file have in Res out of memory...
Have a suggestion?