Sub READ_LINES()
Dim FSO As New FileSystemObject
Dim LineValues() As String
Dim ReadLine As String
Dim TS As TextStream
Set TS = FSO.OpenTextFile(STRFILECSV & NOME_FILE)
ReadLine = TS.ReadLine
Do Until TS.AtEndOfStream
ReadLine = TS.ReadLine
LineValues = Split(ReadLine, ",")
For K = LBound(LineValues) To UBound(LineValues)
Debug.Print LineValues(K)
Next
Loop
End Sub
Now i need to insert into the field of myTable with the same order of soplitted value into LineValues(K)
Sub READ_LINES()
Dim FSO As New FileSystemObject
Dim LineValues() As String
Dim ReadLine As String
Dim TS As TextStream
Dim CNN As New ADODB.Connection
Dim RS As New ADODB.Recordset
CNN.Open ConnectionString:="..."
RS.Open Source:="...", ActiveConnection:=CNN, Options:=adCmdTableDirect
Set TS = FSO.OpenTextFile(STRFILECSV & NOME_FILE)
ReadLine = TS.ReadLine
Do Until TS.AtEndOfStream
ReadLine = TS.ReadLine
LineValues = Split(ReadLine, ",")
RS.AddNew
For K = LBound(LineValues) To UBound(LineValues)
RS.Fields(K) = LineValues(K)
Next
RS.Update
Loop
RST.Close
CNN.Close
End Sub
Sub READ_LINES()
Dim FSO As New FileSystemObject
Dim LineValues() As String
Dim ReadLine As String
Dim TS As TextStream
Dim CNN As New ADODB.Connection
Dim RS As New ADODB.Recordset
CNN.Open ConnectionString:="..."
RS.Open Source:="...", ActiveConnection:=CNN, Options:=adCmdTableDirect
Set TS = FSO.OpenTextFile(STRFILECSV & NOME_FILE)
ReadLine = TS.ReadLine
Do Until TS.AtEndOfStream
ReadLine = TS.ReadLine
LineValues = Split(ReadLine, ",")
RS.AddNew
For K = LBound(LineValues) To UBound(LineValues)
RS.Fields(K) = LineValues(K)
Next
RS.Update
Loop
RST.Close
CNN.Close
End Sub
Is this related to your attempts to deal with the JSON returned from comuni.openapi.it?
If so, whilst VB itself doesn't offer a reasonable native JSON parser, and tricks with vbscript can only directly handle certain subsets of JSON, there might be better methods than writing the response string out to a file and then trying to read it back in.
Perhaps if you explain exactly what you are trying to achieve (rather than starting with a solution that may not be optimal)