1

Topic: As it is possible to make SQL request to two bases Access of Delfi

Prompt, please, as it is possible to make SQL request to two bases Access of Delfi simultaneously. I do not understand as in one ADOQuery to "push" the second basis and to select from it values on  to fields from result of request to the first.
I will be grateful for helps/examples.

2

Re: As it is possible to make SQL request to two bases Access of Delfi

Provider JET allows to specify ODBC sources directly in a request body
So it is possible  to cross in one a bulldog to a rhinoceros
For example  and mssql

SELECT a. F1, a. F2, a. F5, a. F3, a. F4, b. PG, now (), a. F9, a. F6, a. F7, a. F8
FROM (select * from [List1$A2:I] IN [Excel 12.0 xml; HDR=no; IMEX=1; DATABASE=D:\data\cervenec.xlsx]) a
inner join
(select * from viBusinessStructure IN [ODBC; Driver = {SQL Server Native Client 10.0} ;Server=myServer;Database=myDatabase;Trusted_Connection=yes;]) b
on a. F4=b. FAGR
WHERE a. F1 <> ' Overall Result'

Specify the lines of connection necessary to you in section IN and there will be to you a happiness

3

Re: As it is possible to make SQL request to two bases Access of Delfi

Thanks for the information!
I will try.

4

Re: As it is possible to make SQL request to two bases Access of Delfi

In general, tried but  it is impossible. For example, simple request

Select * from Logs IN [Provider=Microsoft. Jet. OLEDB.4.0; Data Source=D:\Config.mdb; Persist Security Info=False;]

Produces an error "Data source it is not found and the driver used by default" though all it is registered is not specified.
Besides, jumps out an authorization window. As it to disconnect in a line of connection it is not clear.
If to fulfill it request at the connected basis the error "jumps out object Parameter is incorrectly defined. Mismatched or incomplete convergence" is presented
How it is all to win?

5

Re: As it is possible to make SQL request to two bases Access of Delfi

alvltss wrote:

in general, tried but  it is impossible. For example, simple request

Select * from Logs IN>>> "<<<[Provider=Microsoft. Jet. OLEDB.4.0; Data Source=D:\Config.mdb; Persist Security Info=False;]

Produces an error "Data source it is not found and the driver used by default" though all it is registered is not specified.
Besides, jumps out an authorization window. As it to disconnect in a line of connection it is not clear.
If to fulfill it request at the connected basis the error "jumps out object Parameter is incorrectly defined. Mismatched or incomplete convergence" is presented
How it is all to win?

like apostrophes are necessary still
But it all the same does not help you, walk under the link

6

Re: As it is possible to make SQL request to two bases Access of Delfi

Why that those variants do not work for me... Not clearly why...
To me prompted other variant -
Select * from Logs IN "D:\Config.mdb" it works.

7

Re: As it is possible to make SQL request to two bases Access of Delfi

Made such request

qry_SQL.SQL.Add (' select Seconds from SutvValueTable ');
qry_SQL.SQL.Add (' INNER JOIN DataTable IN "Q:\Systel\Bin\Zerver.mdb" ');
qry_SQL.SQL.Add (' ON SutvValueTable. RegionIndex = DataTable. RegionIndex ');
qry_SQL.SQL.Add (' AND SutvValueTable. DataIndex = DataTable. DataIndex ');
qry_SQL.SQL.Add (' where Seconds = (SELECT max (Seconds) From SutvValueTable) ');
qry_SQL.SQL.Add (' and (Status> 4095) and (Status <8092) and (Status mod 2 = 0) ');

Syntactic error. What here not so? Perhaps it is necessary to specify somehow a full path to basis in lines 2 and 3?
Also in the first line I want to specify a field from DataTable. But too it is not absolutely clear, with a full path to specify or how?
Prompt, who can, ....