Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Delphi 7 -SQL Statement

Delphi 7 -SQL Statement

Delphi 7 -SQL Statement

In D7, the following pervasive sql statement returns the result multiple times.  Why? Thanks.

procedure ShowContracts;
  L : string;
  L := form1.tbCLient.FieldByName('ClientNumber').asString;
  form1.PvSQLSession1.ServerName := 'Btrieve';
  form1.PvQuery1.DatabaseName := 'LPV8OE';
  form1.PvQuery1.SQL.Add ('select clientnumber, pubNumber, classcode, contractnumber, zone from contracts');
  form1.PvQuery1.SQL.Add (' where clientnumber = ' + quotedstr(L));
  form1.PvQuery1.SQL.Add ('order by clientnumber,pubnumber,contractnumber');
  form1.PvQuery1.Active := true;

RE: Delphi 7 -SQL Statement

What do you mean "returns the result multiple times"?  
Does the query work correctly in the PCC?  

Certified Pervasive Developer
Certified Pervasive Technician

RE: Delphi 7 -SQL Statement

The query is set to display the result in a grid.  The grid is attached to a data source.  The data source is the query.  The query works correctly in the pcc.  Also the query doesn't display anything on a 2nd iteration.

RE: Delphi 7 -SQL Statement

Try adding the following line before setting the ServerName:
Does that have an effect?  

Certified Pervasive Developer
Certified Pervasive Technician

RE: Delphi 7 -SQL Statement

Yes, that took care of the problem with the 2nd and later iteratios.  Still I'm getting the results back more than once and the last set of data I see in the grid is the correct answer.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close