Solved

Delphi SQL and Interbase Triggers

Posted on 1997-08-11
2
344 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
2 Comments
 
LVL 3

Accepted Solution

by:
KE earned 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

28 Experts available now in Live!

Get 1:1 Help Now