Solved

wlak through database table and retrieve values of current record

Posted on 2004-04-06
7
199 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 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
Independent Software Vendors: 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!

 

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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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