select for a text file

A

atse

Hi,
I tried to make select query to a text file using the code below,

<%
sconnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="D:\myforlder\;Extended Properties=""text;HDR=No;FMT=Delimited"""

set conn2=server.CreateObject("ADODB.Connection")
conn2.open(sconnection)

set dRs=conn2.execute("select * from test.txt")

%>

But it complaints that:

Microsoft JET Database Engine error '80040e14'

Syntax error in FROM clause.

/thisfile.asp, line 7 (set dRs=conn2.execute("select * from test.txt"))

Any errors have I made? But if the file is test.csv, it works fine.
But the way, where can I find more samples of query string of all kinds of
database connection?
Thanks

Atse
 
T

TomB

I assume your connection string is on one line?

sconnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="D:\myforlder\;Extended Properties=""text;HDR=No;FMT=Delimited"""
---------^

what's that for?
 
R

Randy Rahbar

Sorry, I can't find what I want. I want the select string for a text file:
"select [what] from [what] where [what] = [what]"

Because there is no table, or field name in the text file, how can I write
this string. Thanks for any idea.

Atse

I'm assuming the first row of your comma-delimited text file are the column
names...

So, if the first column name is Column_ID and the second column name is
Column_Name, I think something like this should work...

SELECT Column_Name FROM yourtextfile.txt WHERE Column_ID = 1


-Randy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top