Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2003
    Location
    Hollywood, FL USA
    Posts
    4

    Exclamation Unanswered: DBF file does not exist!

    Hi Gang,

    I'm using WinXP Pro with IIS. I'm using a .dbf file from a foxpro database. All I have to work from is this dbf file. I finally got it connected (rigerous search) using a file dsn. Now I'm getting a "does not exist" error when I query this file. Here is my code:

    <%

    Set objConn = Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.RecordSet")

    'objConn.Mode = 3
    strConnString = "filedsn=" & Server.MapPath("database/php_prov.dbf.dsn") & "; DBQ=" & Server.MapPath("database/php_prov.dbf")
    objConn.Open strConnString

    query="select * from php_prov.dbf"
    Set RS = objConn.Execute(query)

    response.Write RS("firstname")

    %>

    The error I get is this:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E37)
    [Microsoft][ODBC Visual FoxPro Driver]File 'php_prov.dbf' does not exist.
    /flmedpro/test.asp, line 21


    Can anyone help me!?! Thanks.

  2. #2
    Join Date
    Jan 2003
    Location
    New York
    Posts
    160
    make sure the full path to the dbf has no spaces and the length of the path is less than 128 chars
    Beyond Limitation

  3. #3
    Join Date
    Feb 2004
    Location
    Cooperstown, ND
    Posts
    5

    Cool Try this it worked for me

    Here is the DSN-less connection string I used:

    Set MyConn = Server.CreateObject("ADODB.Connection")
    MyConn.Open "Driver={Microsoft Visual FoxPro Driver};" &_
    "SourceType=DBF;" &_
    "SourceDB=\\Ndctf001\DATA\impact\TIME;" &_
    "Exclusive=No;" &_
    "BackgroundFetch=No"

    The last entry was the key for me.

  4. #4
    Join Date
    Oct 2003
    Location
    Hollywood, FL USA
    Posts
    4

    Thumbs up

    Hi Dark13,

    Thanks for your response. I actually switched to PHP. I no longer use ASP. It was a silly reason, but I'm glad I made the switch. Because I had such a hard time with the connection string and the project needed to be done immediately - I found a much easier connection string with PHP
    PHP Code:
    mysql_connect("localhost","username","password");
    mysql_select_db("database_name"); 
    That's it! Simply two lines of code, which I can memorize and understand what it means. So thanks again, but I'm a PHP user now!

  5. #5
    Join Date
    Feb 2004
    Location
    Cooperstown, ND
    Posts
    5

    OOPS

    Well, at least I tried

  6. #6
    Join Date
    Feb 2004
    Location
    Cooperstown, ND
    Posts
    5

    Question OK perhaps PHP is the way to go...how?

    OK my code worked for about 3 hours now nothing...if I give you what I have could you put it in PHP so I can at least start to learn it?

    <%
    Set MyConn = Server.CreateObject("ADODB.Connection")
    MyConn.Open "Driver={Microsoft Visual FoxPro Driver};" &_
    "SourceType=DBF;" &_
    "SourceDB=\\Ndctf001\DATA\impact\TIME;" &_
    "Exclusive=No;" &_
    "BackgroundFetch=No"
    %>

    <%
    SQL_query = "SELECT * FROM EMPFILE"
    Set RS = MyConn.Execute(SQL_query)
    %>

    <%
    While not RS.EOF
    %>

    <LI><%=RS("efname")%> <%=RS("elname")%><BR>
    PHONE: <%=RS("phone")%><BR><BR>
    <%
    RS.MoveNext
    WEND
    %><%
    RS.Close
    MyConn.Close
    %>

    Or if you know what happened? I didn't touch the code, I walked away and now it refuses to work.

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    where you have
    Code:
    query="select * from php_prov.dbf"
    Set RS = objConn.Execute(query)
    you should have something like,
    Code:
    query="select * from tablename"
    Set RS = objConn.Execute(query)
    You are currently referencing the whole database file instead of a specific table within the database.

  8. #8
    Join Date
    Feb 2004
    Location
    Cooperstown, ND
    Posts
    5
    Originally posted by rokslide
    where you have
    Code:
    query="select * from php_prov.dbf"
    Set RS = objConn.Execute(query)
    you should have something like,
    Code:
    query="select * from tablename"
    Set RS = objConn.Execute(query)
    You are currently referencing the whole database file instead of a specific table within the database.
    OK, but this is DOS FoxPro I'm trying to attach to, you don't use a table name since the table name is the filename. Other than that I don't see a difference.

  9. #9
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618

    OOPS

    Well, at least I tried

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •