Solved

wlak through database table and retrieve values of current record

Posted on 2004-04-06
7
193 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
  • 4
  • 2
7 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 500 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now