Solved

Basic Database Manipulation

Posted on 2004-04-19
5
140 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
[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
  • 3
5 Comments
 
LVL 17

Assisted Solution

by:mokule
mokule earned 25 total points
ID: 10857876
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
ID: 10857943
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
ID: 10858392
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
ID: 10871884
download a simple example from         http://www.geocities.com/esoftbg/ee/Q_20958765.zip
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11020571
page:        http://www.geocities.com/esoftbg/
link:          Q_20958765.zip
0

Featured Post

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!

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 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