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!
¤
¤
¤ 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)
¤ 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.