Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ADO and CSV Upload ( semicolon delimited file)

457 views
Skip to first unread message

Nitin Patil

unread,
Nov 20, 2003, 1:10:16 PM11/20/03
to

I have written the function to upload the CSV File from asp pages.
I want to extend that upload facility to semicolon delimited file.
I use ADO to upload the data and it reads the input file in ADO Record
set.
When I tried it with semicolon delimited file it doesn't work.
The following Code shows the connection with Semicolun demilimited file

Dim adoConnection As New ADODB.Connection
Dim adoText As New ADODB.Recordset

' Now open an ADO recordset on the file using the Microsoft Text Driver
adoConnection.Open "Provider=MSDASQL; Driver={Microsoft Text Driver
(*.txt; *.csv)}; Format=Delimited(;); MaxScanRows=0; FIL=text; DBQ=" &
strPath & ";"

adoText.Open "select * from " & strFileName, adoConnection,
adOpenStatic, adLockReadOnly, adCmdText

The Above Code Doesnt work with Semicolen Delimited file. The variable
strPath contains the path of the file and strFilename contains the file
name.
can anyone tell me what i am doing wrong

thanks in advance
regards
Nitin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Paul Clement

unread,
Nov 21, 2003, 10:52:32 AM11/21/03
to
On Thu, 20 Nov 2003 10:10:16 -0800, Nitin Patil <npa...@igentica.com> wrote:

¤
¤
¤ I have written the function to upload the CSV File from asp pages.

¤ I want to extend that upload facility to semicolon delimited file.
¤ I use ADO to upload the data and it reads the input file in ADO Record
¤ set.
¤ When I tried it with semicolon delimited file it doesn't work.
¤ The following Code shows the connection with Semicolun demilimited file
¤
¤ Dim adoConnection As New ADODB.Connection
¤ Dim adoText As New ADODB.Recordset
¤
¤ ' Now open an ADO recordset on the file using the Microsoft Text Driver
¤ adoConnection.Open "Provider=MSDASQL; Driver={Microsoft Text Driver
¤ (*.txt; *.csv)}; Format=Delimited(;); MaxScanRows=0; FIL=text; DBQ=" &
¤ strPath & ";"
¤
¤ adoText.Open "select * from " & strFileName, adoConnection,
¤ adOpenStatic, adLockReadOnly, adCmdText
¤
¤ The Above Code Doesnt work with Semicolen Delimited file. The variable
¤ strPath contains the path of the file and strFilename contains the file
¤ name.
¤ can anyone tell me what i am doing wrong

¤

A custom delimiter requires a schema.ini file. The contents would look like the following:

[SemiColonDelimited.txt]
ColNameHeader=False
CharacterSet=ANSI
Format=Delimited(;)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetsdk_98.asp

The alternative is to modify the default setting in the Registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text


Paul ~~~ pcle...@ameritech.net
Microsoft MVP (Visual Basic)

Nitin Patil

unread,
Nov 21, 2003, 11:37:54 AM11/21/03
to
Hi Paul
isnt it Possible to do it on the fly. Because i am using ASP to upload
the Semi Colon delimited file and then save that file on server. Using
ADO Recordset i do want to make the connection with this file. and read
it

Paul Clement

unread,
Nov 24, 2003, 1:05:19 PM11/24/03
to
On Fri, 21 Nov 2003 08:37:54 -0800, Nitin Patil <npa...@igentica.com> wrote:

¤ Hi Paul


¤ isnt it Possible to do it on the fly. Because i am using ASP to upload
¤ the Semi Colon delimited file and then save that file on server. Using
¤ ADO Recordset i do want to make the connection with this file. and read
¤ it

The Format statement, for specifying a custom delimiter, is ignored in the connection string. There
is no other choice than to use the method I mentioned.

0 new messages