select for a text file

Discussion in 'ASP General' started by atse, Oct 6, 2003.

  1. atse

    atse Guest

    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
     
    atse, Oct 6, 2003
    #1
    1. Advertising

  2. atse

    Randy Rahbar Guest

    Randy Rahbar, Oct 6, 2003
    #2
    1. Advertising

  3. atse

    TomB Guest

    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?



    "atse" <> wrote in message
    news:GHjgb.240378$...
    > 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
    >
    >
     
    TomB, Oct 6, 2003
    #3
  4. atse

    atse Guest

    "Randy Rahbar" <rvrahbarAThotmail.com> wrote in message
    news:...
    > > But the way, where can I find more samples of query string of all kinds

    of
    > > database connection?

    >
    > http://www.connectionstrings.com
    >
    >

    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
     
    atse, Oct 7, 2003
    #4
  5. atse

    Randy Rahbar Guest

    > 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
     
    Randy Rahbar, Oct 7, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Reiche
    Replies:
    3
    Views:
    10,892
    Michael Reiche
    Feb 5, 2004
  2. Shaiboy_UK
    Replies:
    11
    Views:
    267
    Shaiboy_UK
    Dec 22, 2004
  3. Marco Krechting

    Get text from SELECT into hidden text?

    Marco Krechting, Jan 9, 2005, in forum: ASP General
    Replies:
    5
    Views:
    192
    Aaron [SQL Server MVP]
    Jan 10, 2005
  4. palmiere
    Replies:
    1
    Views:
    432
    Erwin Moller
    Feb 9, 2004
  5. Kurda Yon
    Replies:
    0
    Views:
    122
    Kurda Yon
    Jan 20, 2009
Loading...

Share This Page