Re: Why isn't ADOExpress throwing an exception on error?
- From: Brian Bushay TeamB <BBushay@xxxxxxxxx>
- Date: Fri, 07 Jul 2006 20:55:53 -0500
Raise the error level in your RaiesError or check the TadoConnection.Errors
collection for the error you are generating. Delphi should have it but just
isn't treating it as a critical error
i have a trigger on an SQL Server table
CREATE TRIGGER CheckQuoteNumberMatchesProjectNumber ON dbo.Quotes
FOR INSERT, UPDATE AS
raiserror('dummy', 16, 1)
i then run the code:
procedure TfrmMain.Label2Click(Sender: TObject);
var
qry: TADOQuery;
begin
qry := TADOQuery.Create(nil);
qry.Connection := Conn;
qry.SQL.Text :=
'UPDATE Quotes'+CRLF+
'SET QuoteNumber = ''Q50288-3'''+CRLF+
'WHERE QuoteNumber = ''Q50288-3''';
qry.ExecSQL;
end;
And i get no exception thrown. If i create a new table, with the same
trigger, an exception is thrown. In both cases SQL Server is returning the
error. i can see the error coming back if i packet trace.
HOWEVER
If i run the code:
procedure TfrmMain.Label2Click(Sender: TObject);
var
RecordsAffected: Integer;
szQuery: string;
begin
szQuery :=
'UPDATE Quotes'+CRLF+
'SET QuoteNumber = ''Q50288-3'''+CRLF+
'WHERE QuoteNumber = ''Q50288-3''';
Connection.Execute(szQuery, RecordsAffected);
end;
i DO get an exception thrown.
What is Borland's wrapper around ADO doing to eat the error?
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- Follow-Ups:
- Re: Why isn't ADOExpress throwing an exception on error?
- From: Ian Boyd
- Re: Why isn't ADOExpress throwing an exception on error?
- References:
- Why isn't ADOExpress throwing an exception on error?
- From: Ian Boyd
- Why isn't ADOExpress throwing an exception on error?
- Prev by Date: Why isn't ADOExpress throwing an exception on error?
- Next by Date: ADO and MetaData
- Previous by thread: Why isn't ADOExpress throwing an exception on error?
- Next by thread: Re: Why isn't ADOExpress throwing an exception on error?
- Index(es):