Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TQuery Passed as parameter? OK?

Posted on 1997-03-13
2
Medium Priority
?
251 Views
Last Modified: 2010-04-04
Using Delphi 1.0 and DBase tables...
I am trying to pass a query 7 times to fill a string grid, and it
returns the same, wrong, data each time.

This is the call I am making.

   with frmWeek do    {Fill in column headers with day of week/date}
      for i := 0 to 6 do
         sgWeek.Cells[ i,0 ] := dayOfWeek[ i ] + ' ' +
         JulianDayToGregorianString( (weekstart + i)) ;

   sgcol := 1; {First Usable Column}
   while not (weekstart > weekend) do begin
      CalendarSetRange(weekstart, qWeek);  {This is the painful call}
      qWeek.First;
      dsi := 1;
      while not ( dsi > qWeek.RecordCount )do begin  {While not EOF}
         for sgi := 0 to qWeek.FieldCount - 1 do begin
            with sgWeek do
                 Cells[sgi,dsi] := 'B  ' + qWeek.fields[0].AsString +
                                                '    E ' + qWeek.fields[1].AsString + '  ' +
                                                qWeek.fields[4].AsString;
         qWeek.next;
         end; {for}
         dsi := dsi + 1;
      end; {while}
      sgcol := sgcol + 1;
      weekstart := weekstart + 1.0;
      Update;
   end; {while}
end;{Dates}

-----------------------------
Separate Unit that the query is passed to:
--------------------

procedure CalendarSetRange( start : Double; dayquery : TQuery) ;
{Run query to display assets used during the 24 hour period }
var
    dateToShow : Double;

begin
   dateToShow := start;
   dayquery.Close;
   dayquery.ParamByname('EndTime').AsFloat := int( dateToShow );
   dayquery.ParamByname('StartTime').AsFloat := int( dateToShow + 1.0
);
   dayquery.Prepare;
   dayquery.Close;
   dayquery.Open;
end;

0
Comment
Question by:lorens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:lorens
ID: 1334859
Edited text of question
0
 
LVL 2

Accepted Solution

by:
javiertb earned 200 total points
ID: 1334860
You must include the DBTABLES in your uses line of your separate unit. I don't know if this is what you mean but otherwise I get no error if I pass a Tquery as parameter.

I hope this helps.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question