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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through TStringList 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
Is there any way to loop through a TStringList? I have a procedure that fills in the list with a unique id. I like to perform a query using the values in the List as query criteria:
Code:
For i := 0 to JurorList.Count - 1 do
begin
  DataMod.qry.SQL.Clear;
  DataMod.qry.SQL.Add('UPDATE TABLE1 SET FREE = '' WHERE JURNUM = ' + JurorList.(value of list at index(i)));
  DataMod.qry.ExecSQL;
end;

Is something like this possible?

FYI - I couldn't perform a search since the search was down for maintenance. The answer may be out there somewhere, but if the server's down, it's going to stay out there!

Thanks!
Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Absolutely! You can use a TStringList just like a string array if you want:
Code:
For i := 0 to JurorList.Count - 1 do
begin
  DataMod.qry.SQL.Clear;
  DataMod.qry.SQL.Add('UPDATE TABLE1 SET FREE = '' WHERE JURNUM = ' +
Code:
JurorList[i]
Code:
);
  DataMod.qry.ExecSQL;
end;

 
Knew it had to be something simple!!!

Thanks! Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top