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
Solved

Basic Database Manipulation

Posted on 2004-04-19
5
138 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
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
code issue 8 152
error 1.1 400 Bad request idhttp delphi 18 139
delphi parse string to params 3 136
Delphi Firemonkey: if the Sms contain special characters it won't send it 3 43
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…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 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