?
Solved

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

Posted on 2004-09-04
2
Medium Priority
?
196 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 160 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

762 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