合并ASP经典

时间:2017-01-18 14:20:35

标签: ms-access asp-classic

我有两个MS Access数据库,我正在尝试使用每个数据库的查询创建一个记录集。数据库位于根目录上方的文件夹(db)中。

我尝试了很多代码组合,最新的是;

Conn.Open "DBQ=" & server.mappath("../db") & "\dbaseg.mdb"& ";Driver={Microsoft Access Driver (*.mdb)};"

strSQL="SELECT accom, name, address1, address2, town, county, postcode, telephone, link2, distance, account FROM ukgh where distance is not null and code='" & code & "' and airport='" & airport &  "' UNION  SELECT accom, name, address1, address2, town, county, postcode, telephone, link2, distance, account FROM uksc  IN 'D:\Webspace\mydomain.com\db\dbasesc.mdb' where distance is not null and code='" & code & "' and airport = '" & airport &  "' ORDER BY distance ASC"

set RS = Conn.Execute(strSQL)

这将返回错误:

  

[微软] [ODBC_Microsoft_Access_Driver] _' d:\网络空间\ mydomain.com \分贝\ dbasesc.mdb' _is_not_a_valid_path .__ Make_sure_that_the_path_name_is_spelled_correctly_and_that_you_are_connected_to_the_server_on_which_the_file_resides

如果我将查询更改为:

strSQL="SELECT accom, name, address1, address2, town, county, postcode, telephone, link2, distance, account FROM ukgh where distance is not null and code='" & code & "' and airport='" & airport &  "' UNION  SELECT accom, name, address1, address2, town, county, postcode, telephone, link2, distance, account FROM uksc  IN"  & server.mappath("../db") & "\dbaseg.mdb where distance is not null and code='" & code & "' and airport = '" & airport &  "' ORDER BY distance ASC"

我收到此错误:

  

80040E14 | [微软] [ODBC_Microsoft_Access_Driver] _Syntax_error_in_FROM_clause

我也尝试了其他几种可能性,但仍然无法使其工作,这非常令人沮丧。

我显然做错了什么,但找不到在网站和Google上使用过很多不同搜索字词的解决方案。

当从两个记录集中取出每个记录集时,是否有更简单的方法来合并它们?

0 个答案:

没有答案