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

Hi!

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

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

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,

-Summerset
summersetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
Why the double quotes in this line?

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

Cheers,

Raymond.
0
kambizCommented:
Set Query1.AutoRefresh to True.
It is better to prepare parameters of the query by Query1.Prepare before openning.
0
summersetAuthor Commented:
The double quotes?

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

COLOR CHOICE

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?

-S
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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!

-S
0
kambizCommented:
Hi Summerset,

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

Thank you
Kambiz
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
summersetAuthor Commented:
Kambiz:

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"

Is:
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??

Thanks,

-S

0
kambizCommented:
I have two suggestions:

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

http://www.jordanr.dhs.org/

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,
Kambiz

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.