Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
17
Erster Beitrag:
vor 7 Jahren, 10 Monaten
Letzter Beitrag:
vor 7 Jahren, 9 Monaten
Beteiligte Autoren:
Paul Murray, Arie, Hilario Perez Corona, cardcoder, Toddy Utomo

QRY_ArrivingAirportPassengers object not found.

Startbeitrag von Paul Murray am 23.09.2010 13:50


Greetings All,

I am getting the error "QRY_ArrivingAirportPassengers object not found." when my page opens.

It would seem that the query 'QRY_ArrivingAirportPassengers' can be found because when I set the parameters, the fields and parameters pop up in a list.

Is there some place that I have to flag the query to be used when the page runs?

I tried to look for examples of HExecuteQuery, but I got an error as:

The requested page is not available.
The help browser of WINDEV, WEBDEV and WINDEV MOBILE has not been able to display the requested page.
This information was saved in WXError.log.

Below is my code...Any help would be greatly appreciated...Thanks!! Paul



Global Declarations of PAGE_Page1

start_datetime is DateTime
end_datetime is DateTime
start_datetime = "20100922090000"
end_datetime = "20100922018000"

Initialization of PAGE_Page1

STC_Static2..Value = StringBuild(start_datetime)

gbBresult is boolean

QRY_ArrivingAirportPassengers is Data Source
QRY_ArrivingAirportPassengers.start_datetime = start_datetime
QRY_ArrivingAirportPassengers.end_datetime = end_datetime


// Initializes the query
gbBresult = HExecuteQuery(QRY_ArrivingAirportPassengers)

EDT_connect..Value = gsErr

IF gbBresult True THEN
STC_Static2..Value = HError(hErrCurrent)
EDT_1..Value = HErrorInfo(hErrMessage)
RETURN
END

// Read the first record of the query
HReadFirst(QRY_ArrivingAirportPassengers)
WHILE NOT HOut()
// Process the record of the query
TableAddLine(TABLE_ArrivalData,QRY_ArrivingAirportPassengers.lname,QRY_ArrivingAirportPassengers.fname)

// Read the next record
HReadNext()
STC_Static2..Value = QRY_ArrivingAirportPassengers.lname
END

HCancelDeclaration(QRY_ArrivingAirportPassengers)

Antworten:

I am perplexed.

I changed the code to call the query from the file directly (which I don't think should be necessary since the system should know where the query file is) as:

gbBresult = HExecuteQuery("C:\My Sites\COORDINATOR\COORDINATOR.ana\code\QRY_ArrivingAirportPassengers.WDR",MyConnection1,hQueryWithoutHFCorrection)

The above uses the hQueryWithoutHFCorrection mode which I understood was required if you are doing a complex query and you do not have the native sql server database driver.

This did not work. I got a database error.

So then (by chance), I removed the hQueryWithoutHFCorrection from the code as below and it worked!!

gbBresult = HExecuteQuery("C:\My Sites\COORDINATOR\COORDINATOR.ana\code\QRY_ArrivingAirportPassengers.WDR",MyConnection1)

Why would that be?
Why do I have to put in the entire path for the query that was built with the tool?
Is there a way to post screen shots in this forum (without having to post them on my server and then post the URL)?

Thanks all!!

Paul

von Paul Murray - am 24.09.2010 21:38
Hi

To post screen shots to this forum you can use TinyPic
http://www.tinypic.com/



von Toddy Utomo - am 25.09.2010 02:29
Paul,
I think you have to remove this line
QRY_ArrivingAirportPassengers is Data Source
It is not needed. The query is already part of your project. In fact you are re-declaring the query and loosing the one included in your project.

Can you also post the sql-text of your query? That may help us with the hQueryWithoutHFCorrection question.


von Arie - am 25.09.2010 13:57
Thanks, Arie!!

Here is the SQL:

SELECT DISTINCT
Operator.confirmation_no AS confirmation_no,
Operator.account_no AS account_no,
Operator.fname AS fname,
Operator.lname AS lname,
Operator.dr_no AS dr_no,
Operator.req_date_time AS req_date_time,
Operator.no_pass AS no_pass,
Operator.car_type AS car_type,
Operator.status_flag AS status_flag,
Operator.airport_airline AS airport_airline,
Operator.flight_status AS flight_status,
Operator.airport_flight AS airport_flight,
Operator.airport_from AS airport_from,
Operator.airport_pu_point AS airport_pu_point,
VIP.vip_flag AS vip_flag,
VIP.vip_no AS vip_no
FROM
VIP,
Operator
WHERE
VIP.vip_no = Operator.vip_no
AND VIP.acct_id = Operator.account_no
AND
(
Operator.req_date_time >= start_datetime
AND Operator.req_date_time

von Paul Murray - am 25.09.2010 14:26
Paul,
it looks like the query is not part of the project. Try reparing the project using Project-Other actions.

Or remove the query from the project (using the project explorer). Then right-click on "queries" and select "Add some elements to the project..."


von Arie - am 25.09.2010 14:35
Thanks, Arie,

I did the repair. Then I removed the query from the project. Then I re-imported the project. Same error. Did the repair again. No help.

Here is a screenshot of what I see (you can see the query to the right):

http://65.213.119.67/QRY_NOT_PART_OF_PROJECT.jpg

Paul

von Paul Murray - am 25.09.2010 14:46
Paul,

I think you are making it too hard for yourself and mixing queries. If you just used the sql code as you show in the posting, then it is very easy to get the data. You can then use the results as shown below.

The code below is a shows how to get the data. If you want to use the query and store it, it may be easier to call it as a global procedure.



FOR TillNo=1 TO 5
sql="SELECT * FROM plu_sales_file WHERE plu_sales_till = " +TillNo+" AND plu_sales_date >= "+EDIT_DATE1 + " AND plu_sales_date

von cardcoder - am 25.09.2010 14:53
Thanks, Mike.

I actually have the code working by making a direct call to the full path. And I would prefer to keep the queries in one place for reuse.

I will try declaring it as a global variable.

Best,

Paul



von Paul Murray - am 25.09.2010 14:59
Mmh, I never used queries as "stored queries".
All my queries are in the project itself. Not in the database.
Isn't that what you want?

von Arie - am 25.09.2010 15:04
I don't know. When I create a query in the analysis, it shows up under 'Stored Queries'.

I don't think WebDev's intent is that this will be generated into the database like a stored procedure.

And after my last post, it occurred to me that declaring the full path to the query file won't work unless I preserve that structure on the deployment computer where the application server is.

So I guess for now, I will have to do StringBuild to embed the query in my page.

Quick question (I hope). I have a server where I have a bunch of production web applications running under IIS. If I install the 10 user application server on it, will it screw things up?

Thanks guys!!

Paul

von Paul Murray - am 25.09.2010 15:43
This is becoming frustrating...

My page worked before using the Query. It looks like the magic is gone. :(

I am taking my newly created SQL string and dumping it into an edit control so that I can see the SQL string that I am creating...

It seems to show that I am sending the datetime values in a format that is unacceptable to SQL Server:

SELECT DISTINCT operator.confirmation_no, Operator.fname, Operator.lname, Operator.dr_no, Operator.req_date_time, Operator.no_pass, Operator.car_type, Operator.status_flag, Operator.airport_airline, Operator.flight_status, VIP.vip_flag, Operator.airport_flight, Operator.airport_from, Operator.account_no, Operator.airport_pu_point FROM {oj Operator Left OUTER JOIN VIP on Operator.vip_no = VIP.vip_no} WHERE ( Operator.req_date_time >= 20100925061624710) AND ( Operator.req_date_time

von Paul Murray - am 25.09.2010 16:20
I checked it again and the following code works fine from Interactive SQL in PB:

SELECT DISTINCT operator.confirmation_no, Operator.fname, Operator.lname, Operator.dr_no, Operator.req_date_time, Operator.no_pass, Operator.car_type, Operator.status_flag, Operator.airport_airline, Operator.flight_status, VIP.vip_flag, Operator.airport_flight, Operator.airport_from, Operator.account_no, Operator.airport_pu_point FROM {oj Operator Left OUTER JOIN VIP on Operator.vip_no = VIP.vip_no} WHERE ( Operator.req_date_time >= '09/25/2010 06:16:24') AND ( Operator.req_date_time

von Paul Murray - am 25.09.2010 16:25
Paul,
close the analysis. Then hit File-New and go for the query.
This way the query is embedded in your project as a global object to all your pages. Then you can use it as expected.

I don't do much with webdev. Installing the wb-engine doesn't do much harm I think. Your new website will just be another virtual map in IIS. With a reference for the awp-extension, which needs the webdev engine.



von Arie - am 25.09.2010 17:01
Arie,

I got decent results doing that.

I selected the 'Enter the SQL Code' option.

I replaced the parameters that are normally :start_datetime with {start_datetime}.

I saved the query (same name as before but with a suffix of '2').

I changed all of the code in the page to reference the new query name and I call it as follows:

gbBresult = HExecuteQuery(QRY_ArrivingAirportPassengers2,MyConnection1)

THIS WORKS!! Not sure why the project's analysis does not see the query that was created as part of the analysis. Must be a bug.

Then I tried to deploy the application to another computer running the 10 User Application Server that has an ODBC DSN that is (as far as I can tell) identical to the one on my development workstation.

That does not work and I will follow up in a separate thread.

Not sure why the date translations works. Perhaps I do not need the Native SQL Driver for SQL Server.

Thanks Arie for getting me this far!!

Best,

Paul

von Paul Murray - am 25.09.2010 19:49
Analysis queries are to be used only inside stored procedures.

To use queries in your project, they must be inside the project, not in the analysis.

von Hilario Perez Corona - am 11.10.2010 18:14
Thank you, Hilario.

I will have to consider the implications of that.

For reuse, you would think that you could use a query created in an Analysis.

von Paul Murray - am 12.10.2010 13:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.