Query two Access database files at the same time

I have two database files: one contains company names and IDs, the other contains deal information.  I need to write a query that displays the company name along with the deal record.

In the Access query builder I managed to do this with 'Deals LEFT JOIN [;database=<company database file>].Suppliers' and it works perfectly.

When I try to use that working query with a TADOQuery component in D6 I get a 'Parameter object improperly defined...' error.

Is there a way to use the [;database syntax in Delphi or is there a different way to combine the databases to look up the company name?

This is a legacy app so I can't merge the databases into one file.

Thanks for your help.
0
Ralph
3/21/2013 3:22:00 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

3 Replies
612 Views

Similar Articles

[PageSpeed] 58

Database is a reserved word. You should enclose it in brackets [database].
0
Slobodan
3/22/2013 8:19:52 AM
> {quote:title=Slobodan Dmitrovic wrote:}{quote}
> Database is a reserved word. You should enclose it in brackets [database].

Thanks for your response. I tried brackets and still got the error.

I wrote the following small test query to try to get the code to work:

{code}'SELECT Deals.DeliveredDate, Suppliers.CompanyName FROM DEALS LEFT JOIN [;database=<path to file>\aftermarketitems.mdb].Suppliers ON Deals.LenderID = Suppliers.CompanyID'{code}

I tried inserting brackets as follows:

{code}'SELECT Deals.DeliveredDate, Suppliers.CompanyName FROM DEALS LEFT JOIN [;[database]=<path to file>\aftermarketitems.mdb].Suppliers ON Deals.LenderID = Suppliers.CompanyID'{code}

This still gives me the 'Parameter object is improperly defined' error.  Should I format the SQL and/or brackets differently?
0
Ralph
3/22/2013 1:36:33 PM
I ended up querying the databases separately and combining the needed fields in a ClientDataSet.  I then used the ClientDataSet as the source for the report that I had to print.
0
Ralph
3/22/2013 7:40:25 PM
Reply:

Similar Artilces:

ADO Query to Append Tables from two Access Databases
I want to append a table form one database to a table from another database. Both tables have exactly same structure and the databases are developed using MS Access. How to write ADO query to do this? My query would be something like this: AppendQuery.SQL.Clear; AppendQuery.SQL.Add('insert into tbl1'); AppendQuery.SQL.Add('Select * '); AppendQuery.SQL.Add('from tbl2'); AppendQuery.ExecSQL; How to distinguish that tbl1 and tbl2 are from two different ADO Datasets in this query? To which datasource AppendQuery will be attached? Thanks. Shobha ...

how is it possible to set a filed in a database to automatically add the current time to the filed at run time?
how is it possible to set a filed in a database to automatically add the current time to the filed at run time, is this possible; this filed has already been identified as 'DateTime' .   i am using VS2005 and VB language.* I am using VS 2005 and VB languageThank you, Faezeh. Do you mean when you insert a record into a table, that it automatically adds the current date time to one of its date time column? Like a time stamp? Please correct me if i am wrong?You can do this in your stored procedure rather than in your application code.Assuming you are using SQL Server you c...

Querying a MS Access Database results in a lock file (.ldb) problem
Hello Forum: Windows 2K SP4 Server with IIS 5.0 I have 5 asp pages.  They are all exactly the same except for one small change to the query in each page.  The problem I am having is that a lock file eventually appears for the database and no further queries work. I notice the problem when I view 1.asp, hit the browser's back button, then click on 2.asp, hit the browser's back button again, click on 3.asp.  This is where everything stops.  The web page will eventually time out(sometimes it doesn't) and give you an erro...

repair access database with system database file
I'm using ADMSAccessService but have not found a way to inform the file system database (sysdb) to access the database microsoft access and repair it. Please help me. ...

Two gridviews for two different queries at the same time
I am doing a project a Online Flight Reservation System.The condition for data selection through queries is that: when the user selects for One-Way trip then only the first gridview will show the flights from departure station to destination station but if the user selects for the Round-Trip then I want to display the flights from departure station to destination station in GridView1 and the return flights in GridView2.What should I do for this ? Do I have to use more than one DataSets for individual GridView Contols, each dataset containing different queries Or I need to combine both t...

Error msg: Operation must use an updateable query, on an ASPnet file w/ Access database.
The codes are shown below.  Instead of coding a btn_click script, this example used a Sub InsertRecord():Sub Page_Load(sender As Object, e As EventArgs)If Page.IsPostBack ThenInsertRecord()End IfEnd Sub On the web page, I typed in an email address, a fname, a lname, and a pwd.Clicking the Submit button showed the above error msg.  Clicking the button should run the InsertRecord().  Am I right?  What's wrong with theInsertRecord()?TIA,JeffreystrClasf = "Provider=Microsoft.Jet.OLEDB.4.0;" & _"Data Source=" & _Server.MapPath("/App_Dat...

Can ADO.Net query/update a MS Access database that contains table and fields that contain blank spaces and characters such as "#" in their names?????
I've recently been assigned an asp.net/MS Access project. My code works fine; however, there are table and fields in the Access database that contain blank spaces and characters such as "#" in their names. For example there is a table named "Purchase Orders" and in this table there are a few column fields with names such as "PO#" and “Customer PO#". My question: Is there some sort of wrapping method that I need to implement to allow my ADO.net objects (particularly the "OleDbDataAdapter" and the "DataRow") to accept these naming...

Y ADO.NET does not return a simple ReadOnly Query data as a DataTable though we need most of the times a Single Table of Data from DataBase ? Similar to DataAdapter returning a DataSet ! Or can we Typ
Hi All, After we moved from JSP and started developing a web application in ASP.NET, the DataAdapter is used for all sort of operations like insert/update/delete for a table. But, most of the time we need to query the data from db for a Table/View and the returned data will be a Single Table of data. Though ADO.NET has a facility of keeping such a data in DataTable, y does ADO.NET have not provided a way to return a DataTable. Similar to DataAdapter returning a DataSet. Its like a mix up of DataReader and DataAdapter with Read Only component returning DataTable. Or, please let me know...

How to: Window application with Delphi XE to access MS Access database?
I need to develop a Window application with Delphi XE to generate a form, which can display the data retrieved from an existing Microsoft Access database and update the data value in database as needed. Can someone advise me how should I get started and which implementation shall I use? Which tutorial materials can I look for? I am a new Delphi user. I called Embarcadero tech support on this subject, but got zero support from them. Thank you. Allen Allen, > I need to develop a Window application with Delphi XE to generate a form, > which can display the data retrieved fro...

Uploading Files in MS Access Database and displaying the file in the datagrid
I am trying to upload a file in to the database and display the file as a hyper link in the Data grid. I have been successful in uploading the file to the database and displaying the file in the datagrid. However, there is just minor problem with navigating to the right url. I upload my files in a folder called "Templates". Additionally when I click on the link to display my file it just shows file not found cuz it is just looking for the file name. It should actually be looking for Templates/filename. The only problem is that the hyperlink column in the data grid just identifies t...

Using ADO: two Excel files and two ADOConnections Simultaneously
Windows 7, Delphi XE2. I am using ADO to access two separate excel spreadsheets. They have identical structure. Thus, I have set up two ADOConnections, two ADOQueries, and two TDatasets and connected them all together in a data module. I also have two dbgrids on the main form, one for each spreadsheet. I have prelinked the ADOConnections to the ADOQueries and the datasets and grids. The settings for each connection chain are connected identically except for the files pointed to. The object is to display each spreadsheet in a grid. OK, so I am making the connections dyna...

Shutting down the database server changes database file access permission......
We are using ASA 7.0.2 network server. We have noticed that the server changes database file (and the log file) access permission to read-only when we shut down the server and changes to read/write when we restart it. Is there anyway to change this behaviour and keep the database file permissions the same? Because our application has to override the database with a fresh prepopulated schema when the application is (re)launched. Since the database server makes the files read-only, override fails. And it is not easy to change file permissions from java, programmatically. Thanks, ...

Shutting down the database server changes database file access permission......
We are using ASA 7.0.2 network server. We have noticed that the server changes database file (and the log file) access permission to read-only when we shut down the server and changes to read/write when we restart it. We observer this behaviour on both Unix and WindowsNT. Is there anyway to change this behaviour and keep the database file permissions the same? Because our application has to override the database with a fresh prepopulated schema when the application is (re)launched. Since the database server makes the files read-only, override fails. And it is not easy to change file ...

Two Queries from Two different Databases = ONE Display/Table
What is the best approach to handle this situation?  I have three different databases, which has it's own stored procedure.  I need to call them all at page load and piece together the data.  The common demoninator is the date.  2007 JAN FEB MAR APR row 1 50 60 89 63 row 2 44 21 62 46 2006 JAN FEB MAR APR row 1 60 90 65 41 row2 984 650 452 762 Row 1 and Row 2 come from two different databases and stored procedures.  How can I query the data and present it as it's shown above? Thank you!  &qu...

Web resources about - Query two Access database files at the same time - embarcadero.delphi.ado

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

ERISA and All Claim databases
... laws, on the books in 18 states, requiring self-insured employers to report data about the prices they pay to “all payer claims databases.” ...


Under pressure, DNC restores Bernie Sanders campaign's access to their database - Videos - CBS News
A strange twist in the race for the democratic presidential nomination: the campaign of Vermont Senator Bernie Sanders has filed a complaint ...

IDG Contributor Network: Avoiding ginormous transaction logs with SharePoint databases
... why do we see these humongous transaction logs so often? I am going to blame it on a “misunderstanding” of how Microsoft describes a full database ...

Change your passwords: NexusMods suffers database breach
... security breach by posts on reddit. Cybersecurity firm REN-ISAC had apparently contacted several university IT departments about a database ...

EFF confirms that the DEA has deleted its phone call database
Earlier this year, it was revealed that the NSA's massive surveillance program had a precursor: the Drug Enforcement Administration's USTO, which ...

MacKeeper Leak Highlights Danger of Misconfigured Databases
The Shodan port-scanning service finds at least 35,000 MongoDB databases accessible without a password.

OracleVoice: Oracle Challenges SAP On In-Memory Database Claims
Companies that run SAP’s applications should know that most of those applications can perform much better on Oracle Database than on any other ...

Resources last updated: 12/20/2015 2:42:13 AM