Re: Problem using FMT=Delimited to read comma delimited
From: Val Mazur (group51a_at_hotmail.com)
Date: 05/28/04
- Next message: Val Mazur: "Re: nText field not displaying (ASP)"
- Previous message: Val Mazur: "Re: ODBC(No column properties collection) vs Jet (alphabet ordering)"
- In reply to: Gary Jenovai: "Problem using FMT=Delimited to read comma delimited"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 27 May 2004 22:03:47 -0400
Hi Gary,
Do you have Schema.ini file? You should have it to be able to load text file
properly. Inside of the Schema.ini you should specify delimiter and
datatypes of the columns
--
Val Mazur
Microsoft MVP
"Gary Jenovai" <Gary.Jenovai@kohls.com> wrote in message
news:DBD3E466-E752-4500-9DED-AB632791D004@microsoft.com...
> 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: Val Mazur: "Re: nText field not displaying (ASP)"
- Previous message: Val Mazur: "Re: ODBC(No column properties collection) vs Jet (alphabet ordering)"
- In reply to: Gary Jenovai: "Problem using FMT=Delimited to read comma delimited"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|