wlak through database table and retrieve values of current record

hi!
i use mysqldac to conect to a mysql database. i've connected my table to
a dbgrid. i want to walk through my table and copy some data to  a
string. how do i do this ?


  form1.mySQLTable1.FindFirst;
  while form1.mySQLTable1.FindNext do
  begin
     form1.mySQLTable1.FieldByName('eMail').AsString;
  end;


this doesn't work. Theres another function "GetCurrentRecord(Buffer:PCHar):Boolean".
How do I get the field datas into strings ?


PLEASE HELP !
fuluppiAsked:
Who is Participating?
 
shaneholmesConnect With a Mentor Commented:
var
 MyString: String;

 mySQLTable1.First;
 while not mySQLTable1.Eof do
 begin
  MySTring:= MySTring + FieldByName('Field1').asSTring;
  mySQLTable1.Next;
 end;

Shane
0
 
shaneholmesCommented:
OR Just

var
 MyString: String;
 MyInteger: Integer;

 mySQLTable1.First;
 while not mySQLTable1.Eof do
 begin
  MyString:=  FieldByName('Field1').asSTring;
  MyInteger:=  FieldByName('Field2').asInteger;
 mySQLTable1.Next;
 end;

Shane
0
 
kretzschmarCommented:
as shaneholmes said,
if you need a subset of the tablecontent,
which you will iterate through,
apply a filter before

meikl ;-)
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
fuluppiAuthor Commented:
hi ! what is theres no filter set ? does this produce the exception which is currently annoying me ??? ;-)

0
 
shaneholmesCommented:
Are you getting an exception with my code?

Shane
0
 
shaneholmesCommented:
Let me see how you applied my code - please!

Sahne
0
 
fuluppiAuthor Commented:
got it  ! thank you so much, both ;-)
0
All Courses

From novice to tech pro — start learning today.