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
Solved

Delphi SQL and Interbase Triggers

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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