Solved

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

Posted on 2004-09-04
2
188 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Delphi Firemonkey Need Sample for Online Shopping Example. 2 193
Run video youtube webbrowse 10 74
Reconfigure Delphi Install? 2 65
LAN or WAN ? 11 106
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 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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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