Query1 won't close/Open for me in Windows 2000 Pro???


I am using the following type of query with Delphi 5 on Windows 2000 Professional:

    with Query1 do begin
      with SQL do begin
        Add('SELECT *');
        Add('FROM myDatabase');
        Add('WHERE (myDatabase."Color" = :myParam)');
      ParamByName('myParam').AsString := 'Blue';

The query has always worked fine in Delphi and also with Windows 95A, B, 98 and NT4.

But in Windows 2000 the query does not refresh. I must manually close and reopen the program to refresh. Has anybody else experienced this problem? Or am I missing something?

Any help or guidance would be greatly accepted.

Thanking you in advance,

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

kambizConnect With a Mentor Commented:
Hi Summerset,

Set Query1.AutoRefresh to True.
It is better to prepare parameters of the query by Query1.Prepare before openning.

Thank you
Why the double quotes in this line?

Add('WHERE (myDatabase."Color" = :myParam)');


Set Query1.AutoRefresh to True.
It is better to prepare parameters of the query by Query1.Prepare before openning.
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

summersetAuthor Commented:
The double quotes?

In the database I am using on this project, that column has a break in the title, ie:


Add('WHERE (myDatabase."Color Choice" = :myParam)');

I simplified everything just to show an example of the code...I left the in "" by mistake.

Any ideas about the Query?

summersetAuthor Commented:
Thanks kambiz!

That's one of those things where you just have to roll your eyes... :-)

I'm still curious why it worked in all the previous versions of Windows, but not Win2000?

Post your comment as an answer and I'll give you the points.

Thanks again!

summersetAuthor Commented:

It turns out that autorefresh has nothing to do with the problem. My code appears to be working fine in Win 2000, just like it did in previous versions.

The problem is (oddly) the truncated path in the desktop shortcut to this program. When I install the program (that has the query above) in Win 2000 using ISX that comes with delphi, the shortcut links to it have truncated paths in the "Start In" section of the shortcut link properties, ie:

What should be:
Start In: "C:\Program Files\MyApp Directory"

Start In: C:\Progra~1\MyApp~1

When I use the shortcut link to start the program...the SQL Queries will not refresh until I end the program and start it again.

When I start the program by double-clicking the EXE in it's directory everything works fine.

After I set Query1.AutoRefresh to True and created a new EXE, I copied it onto a floppy and then overwrote the old EXE on the test machine. I then started the program from the open directory because I had opened it to copy the file...when everything worked, I figured you had been right.

Later when I started the program again from the shortcut link -- right back to the old problem. After going back and forth for a couple of hours it finally hit me what was happening.

I spent a few hours today making sure I am correct, and also spent a great deal of time with InstallShield Express. ISX will not put the long path no matter what I do...it always truncates it. I could write 5 more paragraphs on that!

I thought I would update you on what has happened and ask if you had any ideas??



I have two suggestions:

1. Try to use InnoSetup instead of ISX. InnoSetup is a free but powerfull installer program written by Jordan Russell.


2. Place a TSession on your form and set NetFileDir and PrivateDir properties to proper paths. Don't forget to activate the session.

Good luck,

All Courses

From novice to tech pro — start learning today.