?
Solved

Delphi SQL and Interbase Triggers

Posted on 1997-08-11
2
Medium Priority
?
365 Views
Last Modified: 2010-04-04
Howdy;

It appears that when I do an SQL INSERT from a Query Component with the ExecSQL method, it appears that my BEFORE INSERT Trigger to generate my primary key is not getting triggered... because it gives me an error that I'm trying to insert a NULL primary Key... Any ideas on how to get that to fire off the trigger on INSERT?  (It also doesnt fire off the BEFORE DELETE Trigger!)

Thanks

Roger Webb
0
Comment
Question by:Whytboy
[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
 
LVL 3

Accepted Solution

by:
KE earned 600 total points
ID: 1341111
The problem with triggers is that the before/after terms are related to you database server, and not how Delphi handles the transaction. Your database server (or local server) will not insert your record as long as Delphi is holding it back, because of the missing key. What i'm trying to say is that the server is never being told to insert the record as long as the record fails validation in Delphi - and this is the reason for the unfired trigger.
To solve the problem, just insert the key field manually into the dataset, and set the "Required" property to false. After a (hopefully) succesfull insert, you may need to refresh the dataset to get the key field updated.

Kenneth Ellested
0
 

Author Comment

by:Whytboy
ID: 1341112
Thanks... sorry it took so long.
0

Featured Post

Industry Leaders: 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

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

741 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