Solved

Basic Database Manipulation

Posted on 2004-04-19
5
139 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

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

Suggested Solutions

Title # Comments Views Activity
When I am typing into a TEdit last word repeats 7 162
Downloading email attachments 2 85
QRReport  TQrmemo vertical stretching 1 57
Firemonkey BASS_Init into a thread 17 57
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

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