Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi 7 -SQL Statement

Status
Not open for further replies.

JimReiley

MIS
Dec 10, 2004
58
US
In D7, the following pervasive sql statement returns the result multiple times. Why? Thanks.
JimR

procedure ShowContracts;
var
L : string;
begin
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;
end;
 
What do you mean "returns the result multiple times"?
Does the query work correctly in the PCC?

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
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.
 
Try adding the following line before setting the ServerName:
form1.PvQuery1.SQL.Clear;
Does that have an effect?

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top