Access query of linked tables returns EOF

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: Access query of linked tables returns EOF

    It works fine for me. I created a database called db14.mdb containing one
    local and two linked tables (each from a different database). I then created
    a saved query called testquery that links them via this SQL:
    SELECT linkedA.SomeData, linkedA.fldDay, linkedB.Description, local.Field1
    FROM (tblContacts AS linkedA INNER JOIN PartList1 AS linkedB ON
    linkedA.SomeData = linkedB.PartNumber) INNER JOIN Table1 AS [local] ON
    linkedA.SomeData = local.FK;

    I then used this code to get results from ASP:
    Dim rs, cn
    Set cn = server.createobject("ADODB.Connection")
    cn.Open "provider=microsoft.jet.oledb.4.0;" & _
    data source=" & server.mappath("db14.mdb")
    Set rs = server.createobject("ADODB.Recordset")
    cn.testquery rs
    response.write rs.eof
    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing

    EOF was false.
    Are you sure you have all the databases in a folder(s) to which the IUSR
    account has permissions?

    RJM wrote:
    > I am using an Access query in database A that references linked
    > tables in databases B and C to return related records in B and C.
    >
    > The query runs fine in Access, but when referenced via ASP, it
    > returns EOF. I am assuming my code is correct, since queries in A
    > that only reference the same linked tables in B only, or C only, do
    > return the appropriate records via the same ASP code.
    >
    > Is there some limitation of ASP when retrieving information via Access
    > queries? Does the ASP code need to be modified in some way?
    >
    > Here's a bit of my method:
    > -------------------------------------------------
    > Set oCmd = Server.CreateObject ("ADODB.Command")
    > oConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
    > oCmd.ActiveConnection = oConn
    > oCmd.CommandText = "testquery"
    > oCmd.CommandType = &H0004
    > Set oRs = Server.CreateObject ("ADODB.Recordset")
    > Set oRs = oCmd.Execute
    > -------------------------------------------------
    > Again, this works if "testquery" references data in database A, B, or
    > C, but not the combination of B and C I'm looking for.
    >
    > Any help would be appreciated.
    >
    > Thanks

    Bob Barrows Guest

  2. Similar Questions and Discussions

    1. Problem: Cannot query linked Access tables in CFMX 6.1
      I?m using CFMX 6.1 on a Windows Server 2003. I have an Access DB with some tables linked to a SQL Server 2000 DB running on another machine. When I...
    2. Connecting to linked SQL tables through access
      Hello, I have searched the web and can't find a solution, but this must (maybe) be common. I am creating an asp page that connects to an access...
    3. Linked 'tables' (access) local - to -remote?
      Is it actually possible for a local access 2000 database to link to a remote database online via linked tables... I know www.aspfaq.com has...
    4. problems with linked access tables in ASP
      Hello, I've seen this posting many times, but there are no responses to it... I hope it's not too difficult to fix. I have two databases, one...
    5. asp search returns no results from access query
      access 2000 query: here's what i want to do. from an asp page, perform a search on a table in access. i have used sql code in the asp page...
  3. #2

    Default Re: Access query of linked tables returns EOF

    Nevermind. Found it.

    A LIKE criteria in the database A query contained a * wildcard, while ASP /
    SQL uses %. The Access query creates a SQL statement that when run from ASP
    returned no values (LIKE "foo*" returns nothing, LIKE "foo%" returns
    foobar). I changed LIKE to = and spelled out the each available result
    explicitly, and all is well.

    Thank you for your response though.


    "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    news:ObKsZIYQDHA.3016@TK2MSFTNGP10.phx.gbl...
    > It works fine for me. I created a database called db14.mdb containing one
    > local and two linked tables (each from a different database). I then
    created
    > a saved query called testquery that links them via this SQL:
    > SELECT linkedA.SomeData, linkedA.fldDay, linkedB.Description, local.Field1
    > FROM (tblContacts AS linkedA INNER JOIN PartList1 AS linkedB ON
    > linkedA.SomeData = linkedB.PartNumber) INNER JOIN Table1 AS [local] ON
    > linkedA.SomeData = local.FK;
    >
    > I then used this code to get results from ASP:
    > Dim rs, cn
    > Set cn = server.createobject("ADODB.Connection")
    > cn.Open "provider=microsoft.jet.oledb.4.0;" & _
    > data source=" & server.mappath("db14.mdb")
    > Set rs = server.createobject("ADODB.Recordset")
    > cn.testquery rs
    > response.write rs.eof
    > rs.Close
    > Set rs = Nothing
    > cn.Close
    > Set cn = Nothing
    >
    > EOF was false.
    > Are you sure you have all the databases in a folder(s) to which the IUSR
    > account has permissions?
    >
    > RJM wrote:
    > > I am using an Access query in database A that references linked
    > > tables in databases B and C to return related records in B and C.
    > >
    > > The query runs fine in Access, but when referenced via ASP, it
    > > returns EOF. I am assuming my code is correct, since queries in A
    > > that only reference the same linked tables in B only, or C only, do
    > > return the appropriate records via the same ASP code.
    > >
    > > Is there some limitation of ASP when retrieving information via Access
    > > queries? Does the ASP code need to be modified in some way?
    > >
    > > Here's a bit of my method:
    > > -------------------------------------------------
    > > Set oCmd = Server.CreateObject ("ADODB.Command")
    > > oConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
    > > oCmd.ActiveConnection = oConn
    > > oCmd.CommandText = "testquery"
    > > oCmd.CommandType = &H0004
    > > Set oRs = Server.CreateObject ("ADODB.Recordset")
    > > Set oRs = oCmd.Execute
    > > -------------------------------------------------
    > > Again, this works if "testquery" references data in database A, B, or
    > > C, but not the combination of B and C I'm looking for.
    > >
    > > Any help would be appreciated.
    > >
    > > Thanks
    >
    >

    RJM Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139