Solved

Please, anyone HELP ME!!! dbExpress NOOB question - I just need a simple example please

Posted on 2004-09-04
2
180 Views
Last Modified: 2010-04-05
Hi folks,

I´ve already looked forward and read about GENERATORs and TRIGGERs (for days). I am using Delphi 7 and Firebird with dbExpress components (i need to implement this in dbExpress).

My NOOB question is: could anyone do a example for me (?)using:
- SQLConnection + SQLQuery + ClientDataSet + DataSetProvider;
- 2 buttons (INSERT and POST);
- 1 DBGrid

Suppose that i just have one table called CUSTOMER and this table contains just two fields (ID and CUSTOMER_NAME).

What i deeply need is: when i click in INSERT button, i just fill the field CUSTOMER_NAME (in the DBGrid) with anyname and, after click in POST, i´d like that the GENERATOR works (as well the TRIGGER) and i could see, immediatly, the NUMBER generated besides the CUSTOMER_NAME (in the field ID, which is in the DBGrid too).

Hey guys, i deeply need it. If anyone helps me, i will be very happy.

Best regards and thx. for now.
0
Comment
Question by:joelsilva
2 Comments
 

Accepted Solution

by:
joncmora earned 40 total points
Comment Utility
The best way to get the generated number is to implement the INSERT in a stored procedure then make it an OUT parameter.

Another way is to get a bookmark for the newly inserted record, refresh/requery the table, then go back to the bookmarked record. Remember to call DisableControls before refreshing to minimize too much refresh. Call EnableControls after the refresh.

Hope this helps...
0
 

Author Comment

by:joelsilva
Comment Utility
Thx. for your comments.

I like the STORED PROCEDURE way. Must i create this STORED PROCEDURE in Delphi or in the database level? Could you give a example using SP?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

13 Experts available now in Live!

Get 1:1 Help Now