?
Solved

wlak through database table and retrieve values of current record

Posted on 2004-04-06
7
Medium Priority
?
200 Views
Last Modified: 2010-04-05
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
Comment
Question by:fuluppi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 2000 total points
ID: 10767319
var
 MyString: String;

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

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10767330
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10767593
as shaneholmes said,
if you need a subset of the tablecontent,
which you will iterate through,
apply a filter before

meikl ;-)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:fuluppi
ID: 10767778
hi ! what is theres no filter set ? does this produce the exception which is currently annoying me ??? ;-)

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10767795
Are you getting an exception with my code?

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10767800
Let me see how you applied my code - please!

Sahne
0
 

Author Comment

by:fuluppi
ID: 10767805
got it  ! thank you so much, both ;-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question