Solved

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

Posted on 2004-09-04
2
191 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
[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
2 Comments
 

Accepted Solution

by:
joncmora earned 40 total points
ID: 11987426
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
ID: 11988939
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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 this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

695 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