Error using ado to read cvs file
- From: Light <a@xxxxx>
- Date: Wed, 12 Sep 2007 22:44:49 -0400
Hi All,
I am using the following code to read csv file, but I am getting error if the data in the following column is having the different format.
For example, I have two rows:
1234, 1234
abcd, 1234
Instead of getting abcd, I will get a null string. If the column in the second row is also a number likes 56789, it will be fine. The same error goes for the second column if the data format changed.
So is my set up correct?
------------------------------------------------
Set Conn = Server.CreateObject("ADODB.Connection")
strConn = "Driver={Microsoft Text Driver (*.txt;*.csv)};" & _
"DefaultDir=" & path
'Opens the connection to the data store
Conn.Open strConn
' csv file
strCmd = "SELECT * from [" & filename & "]"
Set RS = Server.CreateObject("ADODB.Recordset")
'Opens the recordset
RS.Open strCmd, Conn,adOpenStatic,adLockReadOnly
oRs.Fields(0).Value = "" if data format changed from the previous row.
--------------------------------------------------
TIA
P.S. If I am in the wrong NG, please point me to the correct one.
.
- Follow-Ups:
- RE: Error using ado to read cvs file
- From: "Walter Wang [MSFT]"
- Re: Error using ado to read cvs file
- From: ekkehard.horner
- RE: Error using ado to read cvs file
- Prev by Date: Re: Transactions across several subroutines
- Next by Date: Re: Error using ado to read cvs file
- Previous by thread: Re: Transactions across several subroutines
- Next by thread: Re: Error using ado to read cvs file
- Index(es):
Relevant Pages
|
|