Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exceptions, MS SQL & ODBC

Posted on 1997-09-16
3
Medium Priority
?
242 Views
Last Modified: 2010-04-04
When I add a record which invalidates referential integrity to a MS SQL database (using ODBC) in code I recieve no exception, however when I enter the same data using a visual component I recieve the exception - how can I get the exception to be generated by my code?
0
Comment
Question by:zac
[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
3 Comments
 

Expert Comment

by:joseramos
ID: 1345081
I don't know if I understood the question ... but you may try wrapping your code within a try/except block:

        try
           { ... your code that invalidates referential integrity }
        except
            raise;     { or however you want to handle it }
        end;
0
 
LVL 1

Author Comment

by:zac
ID: 1345082
The problem is that although an exception should be generated by the code, it is not!

I have found a work-arround which is to use queries, however I would be interested in finding out the reason for this strange behaviour.
0
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 200 total points
ID: 1345083
Zac,

Set up a Trigger on your table for the Update / Insert / Delete action using SQL Enterprise Manager that examines the data BEFORE it is commited to the table and have the trigger a RAISEERROR statement which WILL be caught by Delphi so that you can handle it in a Try/Except/Finally Block.

Hope this helps.
Pegasus
0

Featured Post

[Webinar] Protection from Cyberattacks

In this session, we’ll dive into the complexities of modern cyber threats and why only multi-vector protection can keep today’s businesses secure through the various stages of a cyberattack, across multiple vectors. Thursday September 14, 2017 10:00 A.M. PDT

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…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

730 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