Solved

Basic Database Manipulation

Posted on 2004-04-19
5
134 Views
Last Modified: 2010-04-05
Hello Experts!

I am new to Delphi.  I want to get a data from a certain table of my database without using TDBEdit.  I will have to use TEdit.  I want to set the initial value of TEdit to the first row from my table and once NEXT button is click, it will point to the next row.

Could anybody give me an idea on how to do this ?

Regards!
Entrance2002 :-)
0
Comment
Question by:Renante Entera
  • 3
5 Comments
 
LVL 17

Assisted Solution

by:mokule
mokule earned 25 total points
Comment Utility
You should use TTable or TQuery or TADOTable or TADOQuery or similar

Then

Table1.First goes to first row

Table1.Next goes to next row

Table1.FieldByName('fieldname').AsString gives You the desired field value.
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 75 total points
Comment Utility
it is important to use the event AfterScroll of the DataSet:

procedure TForm1.Query1AfterScroll(DataSet: TDataSet);
begin
  Edit1.Text := Query1.FieldByName('........').AsString;
end;
0
 
LVL 17

Assisted Solution

by:geobul
geobul earned 25 total points
Comment Utility
Alternatively you may use Form1.OnCreate event to set the initial state and Button1.Click (NEXT button) for reading next values:

procedure TForm1.FormCreate(Sender: TObject);
begin
  Table1.Open;
  Edit1.Text := Table1.FieldByName('Field1').AsString;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Table1.Next;
  if not Table1.eof then Edit1.Text := Table1.FieldByName('Field1').AsString;
end;

Regards, Geo
0
 
LVL 12

Expert Comment

by:esoftbg
Comment Utility
download a simple example from         http://www.geocities.com/esoftbg/ee/Q_20958765.zip
0
 
LVL 12

Expert Comment

by:esoftbg
Comment Utility
page:        http://www.geocities.com/esoftbg/
link:          Q_20958765.zip
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

12 Experts available now in Live!

Get 1:1 Help Now