Use Text Files with ADO
Connect to text file(s) and perform advanced queries using ADO. You can even return recordsets on CSV file without a header.
AI
Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Codice sorgente
Option Explicit
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset
Private Sub Form_Load()
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & ";" _
& "Extended Properties='text;FMT=Delimited'"
'-- Use Following connection string if text file doesn't have a header for field names
'oConn.Open "Provider=Microsoft.Jet" _
& ".OLEDB.4.0;Data Source=" & App.Path _
& ";Extended Properties='text;HDR=NO;" _
& "FMT=Delimited'"
Set oRS = oConn.Execute("Select * from Data.txt ")
Dim ofield As ADODB.Field
Do Until oRS.EOF
For Each ofield In oRS.Fields
Debug.Print "Field Name = " & ofield.Name & " Field Value = " & ofield.Value
Next ofield
oRS.MoveNext
Loop
End Sub
Commenti originali (3)
Recuperato da Wayback Machine