On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
TxtFile = "C:\MyDBFolder\"
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" & TxtFile & ";Extended Properties=""text;HDR=YES;FMT=Delimited"""
objRecordset.Open "SELECT * FROM CSVFile.csv",objConnection, adOpenStatic, adLockOptimistic, adCmdText
Do Until objRecordset.EOF
Wscript.Echo "FieldName_1: " & objRecordset.Fields.Item("FieldValue_1")
Wscript.Echo "FieldName_2: " & objRecordset.Fields.Item("FieldValue_2")
Wscript.Echo FieldName_3: " & objRecordset.Fields.Item("FieldName_3")
objRecordset.MoveNext
Loop
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
TxtFile = "C:\MyDBFolder\"
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" & TxtFile & ";Extended Properties=""text;HDR=YES;FMT=Delimited"""
objRecordset.Open "SELECT * FROM CSVFile.csv",objConnection, adOpenStatic, adLockOptimistic, adCmdText
Do Until objRecordset.EOF
Wscript.Echo "FieldName_1: " & objRecordset.Fields.Item("FieldValue_1")
Wscript.Echo "FieldName_2: " & objRecordset.Fields.Item("FieldValue_2")
Wscript.Echo FieldName_3: " & objRecordset.Fields.Item("FieldName_3")
objRecordset.MoveNext
Loop