Why isn't ADOExpress throwing an exception on error?
- From: "Ian Boyd" <ian.borlandnews010@xxxxxxxxxxxx>
- Date: Fri, 7 Jul 2006 16:15:23 -0400
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?
.
- Follow-Ups:
- Re: Why isn't ADOExpress throwing an exception on error?
- From: Brian Bushay TeamB
- Re: Why isn't ADOExpress throwing an exception on error?
- Prev by Date: Re: ADO Data type mismatch
- Next by Date: Re: Why isn't ADOExpress throwing an exception on error?
- Previous by thread: Master-Detail using disconnected recordset
- Next by thread: Re: Why isn't ADOExpress throwing an exception on error?
- Index(es):
Relevant Pages
|