Results 1 to 2 of 2

Thread: I'm new to this and not having any luck

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    3

    I'm new to this and not having any luck

    --------------------------------------------------------------------------------

    Hey gurus,

    I have a problem with ADO.

    I am trying to develop an asp page and connect to a Visual FoxPro .dbf I don't know whats going on, but it won't work.

    Here is what I've got.


    Code:
    <%
    function getCurrentDir()
      getcurrentdir = mid(server.MapPath("testbook.dbf"), 1, instrrev(server.MapPath("testbook.dbf"), "\"))
      getCurrentDir = left(getCurrentDir, len(getCurrentDir) - 1)
    end function
    
    Dim adoCon
    Dim rsGuestbook
    Dim strSQL
    dim path
    
    path = createobject("wscript.shell").currentdirectory
    
    set adocon = server.CreateObject("ADODB.Connection")
    
    adoCon.Open "DSN=test"
    
    'Driver={Microsoft Visual FoxPro Driver};" & _
    '     "SourceType=DBF;" & _
    '     "SourceDB=" & getCurrentDir & ";" & _
    '     "Exclusive=No;"
    							
    set rsGuestbook = server.CreateObject("ADODB.recordset")
    
    strsql = "SELECT * FROM testBook"
    Response.Write(strsql)
    rsGuestbook.Open strsql, adoCon
    
    do while not rsGuestbook.EOF
    	Response.Write("<BR>")
    	Response.Write(rsGuestbook.Fields("name").Value)
    	Response.Write("<BR>")
    	Response.Write(rsGuestbook.Fields("Comments").Value)
    	Response.Write("<BR>")
    	rsGuestbook.MoveNext
    loop
    
    rsGuestbook.Close
    set rsguestbook = nothing
    set adocon = nothing
    %>
    The error I get is
    Quote:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

    [Microsoft][ODBC Visual FoxPro Driver]File 'testbook.dbf' does not exist.

    /testweb/guestBook.asp, line 33



    Its there, I promise. Its in the current directory. My DSN is setup on the server with a System DSN. I'm not developing on the webserver, if that matters.

    Hope someone can help me out, I'm about to go NUTS.

    Thanks

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    3

    Re: I'm new to this and not having any luck

    I just did a similar process in a VB application and it took off without a hitch. I don't know what that means, except frustration on my part.

Posting Permissions

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



Click Here to Expand Forum to Full Width