I have a CSV export from an LDAP DB and I have to read data with a Classic ASP page.
The format of the CSV file is like
CRDLVR47E67L781V#1653#CORDIOLI#ELVIRA#658#elvira.cordioli@sender.at#SI
I can read the file line by line, and have to split the line manually.
If I change the #
value to a comma I can access the file by column. Can I make the asp page able to access the file by column, in order to obtain the single value keeping the #
separator?
My connection string is
Set oConn = Server.CreateObject("ADODB.connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=http://export/caselle.csv;Extended Properties='text;HDR=Yes;FMT=Delimited'"
and I can read line from the CSV file with the query
Set RS=Server.CreateObject("ADODB.recordset")
RS.open "SELECT * FROM utenti_aospbo.csv", oConn
now I can only read rs.fields(0)
, that output the entire line, like
CRDLVR47E67L781V#1653#CORDIOLI#ELVIRA#658#elvira.cordioli@sender.at#SI
I'd like to have
response.write rs.fields(0) 'CRDLVR47E67L781V
response.write rs.fields(5) 'elvira.cordioli@sender.at
While I can't rule out that there is some version of OLEDB that does HTTP or accepts FMT and FORMAT in the connection string, I'm sure that the Data Source property of an ADODB Text connection needs to be a folder.
Instead of trying to specify a global separator in the connection string or the in the registry, I'd use a schema.ini file to describe the meta info in a file specific way.
All in one: