<As a novice, so there will be a lot of questions to ask the> question on the database!

Category: Delphi -> Database Author: biaode520 Date: 2001-07-10 10:32:30
 
biaode520
2001-07-10 10:32:30
I used to do a paradox table, table structure I have created. I'll delphi

added DataSource1, table1, query1.
table1 connected to a123.db, the data source is connected to the table1, query1 connected to datasource1. Then I used Query1.SQL.Add

execute sql statement.
Now I want to implement such a statement.
select max (Index) from table1;
both: Query1.SQL.Add ('select max (Index) from table1');
then execute Query1 . ExecSQL;

now I want to use the 'select max (Index) from table1' statement to query the data value attached to tempIndex.

what function do I put this query result value attached to tempIndex it?
Please advise!

lilelelilele
2001-07-10 10:46:15
Query1.ExecSQL; ----> to Query1.Open;

ran down to see the results of the program not
njstorm
2001-07-10 11:06:14
'select max (index) AS temp from table1';
tempindex: = stringtoint (query1.fieldbyname ('temp'). asstring);
liming0453
2001-07-10 11:19:18
var
tempIndex: integer;
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add ('select max (Index) As temp from shangwu');
Query1.ExecSQL;
; tempIndex: = query1.fieldbyname ('temp'). asInteger;
ShowMessage (IntToStr (tempIndex));
end;
yangzy1979
2001-07-10 11:31:25
how No one came to help me solve it?
I beg you, help me! ?
ANFUYUN
2001-07-10 11:36:30
You see I write for you?

Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add ('select max (Index ) As temp from shangwu ');
Query1.ExecSQL;
tempIndex: = strtoint (query1.fieldbyname (' temp '). asstring);
ShowMessage (IntToStr (tempIndex));
zhanyueziluo
2001-07-10 11:56:04
how no one will help me find it?
spppa
2001-07-10 12:16:01
Okay, I give it a try first!
xienan369999
2001-07-10 12:25:28
After my test, Query1.ExecSQL;
should be added after Query1.Open;
or directly Query1.Open;

Thank you Upstairs you for the!