Ms Access在delphi中的单独数据库中连接表

时间:2018-05-15 14:36:58

标签: database delphi ms-access join odbc

我使用ADOConnection和AdoQuery在MS Access(mdb)数据库上执行查询。我想在不同的数据库(mdb文件)中连接两个表。我在网上搜索并找到了这个解决方案:(示例)

select [ZRDocs].* from [ZRDocs] left join [;database=d:\2222.mdb].[ZRDocItems] AS abc on [ZRDocs].[ID] = [abc].[DocID];

当我在MSAccess中查询它时,它工作正常但是当我使用ADOQuery执行它时,它会引发异常:

Parameter object is improperly defined. Inconsistent or incomplete information was provided.

我使用的是Microsoft.Jet.OLEDB.4.0提供程序。

我也使用了完整的连接字符串:

select [ZRDocs].* from [ZRDocs] 
left join [Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=d:
\2222.mdb;Mode=Share Deny None;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;].[ZRDocItems] AS abc 
on [ZRDocs].[ID] = [abc].[DocID];

我搜索谷歌和许多页面,但没有发现任何东西。 那么,如何使用delphi(ADO)连接来自不同mdb(访问)数据库的两个表?

1 个答案:

答案 0 :(得分:0)

试试这段代码:

{
    "loader": {
        "script": "dojo2",
        "config": {
            "waitSeconds": 60,
            "packages": [ {
                    "name": "objects",
                    "location": "objects"
                }, {
                    "name": "edits",
                    "location": "./",
                    "main": "edits"
                }, {
                    "name": "prepare",
                    "location": "TESTS",
                    "main": "prepare"
                }, {
                    "name": "common",
                    "location": "./",
                    "main": "common"
                }, {
                    "name": "socket",
                    "location": "http://localhost:2020/socket.io",
                    "main": "socket.io"
                }
            ]
        }
    },
    "suites": [
        "./functional/InitTests.js"
    ],
    "environments": [ {
            "browserName": "chrome"
        }
    ],
    "tunnelOptions": {
        "drivers": [
            "chrome"
        ],
        "port": 4444,
        "version": "3.4.0",
        "maxConcurrency": 1,
        "runnerClientReporter": {
            "writeHtml": false
        }
    },
    "tunnel": "null",
    "leaveRemoteOpen": true,
    "grep": ""
}