Problem using FMT=Delimited to read comma delimited
From: Gary Jenovai (Gary.Jenovai_at_kohls.com)
Date: 05/27/04
- Next message: Vyacheslav Lanovets: "ADOX: ODBC(No column properties collection) vs Jet (alphabet ordering)"
- Previous message: Mike UK: "RE: SHAPE with ADO and Recordsets - unable to see data in 2nd child"
- Next in thread: Val Mazur: "Re: Problem using FMT=Delimited to read comma delimited"
- Reply: Val Mazur: "Re: Problem using FMT=Delimited to read comma delimited"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 27 May 2004 09:01:07 -0700
One of our developers is using ADO with FMT=Delimited to read a comma delimited file. It works fine except for any fields that begin with "KK". The KK is not returned. For example a file AA, 2213, KK2310 would return AA, 2213, 2310. It seems that KK must trigger it as some sort of designation, causing the KK not to returned. I've included the code below. Project references needed are Microsoft ActiveX Data Objects Recordset 2.6 Library and Microsoft ActiveX Data Objects 2.6 Library (we've tried this with ADO 2.5, 2.6, and 2.7, all same results). Any suggestions on how to cause the KK to be read would be appreciated. Here's the code:
Private Sub Command1_Click()
Dim connCSV As New ADODB.Connection
Dim rsTest As New ADODB.Recordset
Dim adcomm As New ADODB.Command
Dim path As String
path = "C:\" 'Here Test dir is the Directory where
' the text file is located. don't write the file name here.
'This is connection for a text file with Header (i.e., columns
'connCSV.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _
'& path & ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False"
'
connCSV.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & path & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
rsTest.Open "Select * From test.txt", _
connCSV, adOpenStatic, adLockReadOnly, adCmdText
Do While Not rsTest.EOF
MsgBox rsTest(0) 'Selecting the data
MsgBox rsTest(1)
MsgBox rsTest(2)
rsTest.movenext
Loop
'How come the data KK1210 doesn't get returned
'rsTest(2) only brings back 1210
'SAVE THE FOLLOWINT TO C:\TESTDIR\TEST.TXT
'AND RUN THE ABOVE CODE
'Name,Code,StyleID
'John,KK,KK1210
End Sub
- Next message: Vyacheslav Lanovets: "ADOX: ODBC(No column properties collection) vs Jet (alphabet ordering)"
- Previous message: Mike UK: "RE: SHAPE with ADO and Recordsets - unable to see data in 2nd child"
- Next in thread: Val Mazur: "Re: Problem using FMT=Delimited to read comma delimited"
- Reply: Val Mazur: "Re: Problem using FMT=Delimited to read comma delimited"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|