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?
 
shaneholmesCommented:
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
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.