Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

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 !
0
fuluppi
Asked:
fuluppi
  • 4
  • 2
1 Solution
 
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now