Solved

Delphi SQL and Interbase Triggers

Posted on 1997-08-11
2
358 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 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

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

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 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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
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…

690 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