Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EOleException... SQL Server 7...

147 views
Skip to first unread message

Justin Pitts

unread,
Dec 29, 2000, 10:08:16 AM12/29/00
to
among other things, EOleException is raised by ADO when there is a database
error.

I use this for trapping/logging ADO errors:

unit adoerrorsnstuff;

interface

uses
ADODB, sysutils;

const
CRLF = #13 + #10;

procedure LogADOError(E: Exception; storedproc: TADOStoredProc);

implementation

uses
svcmgr, comobj;

function FormatOleError(sp: TADOStoredProc; E: EOleException): string;
var
index : integer;
errormsg : string;
begin
errormsg := 'ADO Error.' + CRLF
+ sp.ProcedureName + ': ' + E.Message;
errormsg := errormsg + CRLF;

for index := 0 to sp.Parameters.Count - 1 do
begin
errormsg := errormsg + Format('Parameter ''%s'' : %s',
[sp.parameters[index].name, sp.parameters[index].value]);
errormsg := errormsg + CRLF
end;
errormsg := errormsg + CRLF;
if sp.Connection <> nil then
with sp.connection.Errors do
for index := 0 to (Count - 1) do with Item[index] do
if not ((index > 0) and (NativeError = 3621)) then
errormsg := errormsg +
' Error #' + IntToStr(Index) + ':' + CRLF +
' Description: ' + Description + CRLF +
' Number: ' + IntToStr(Number) + CRLF +
' Native: ' + IntToStr(NativeError) + CRLF +
' Source: ' + Source + CRLF +
' State: ' + SQLState + CRLF + CRLF;
result := errormsg;
end;

procedure LogADOError(E: Exception; storedproc: TADOStoredProc);
var
msg : string;
begin
if E is EOleException then
msg := FormatOleError(storedproc, e as EOleException)
else
msg := E.message;
with TEventLogger.Create('ADODCR') do
begin
LogMessage(msg);
free;
end;
end;

end.

Olivier Vincent

unread,
Dec 29, 2000, 10:02:34 AM12/29/00
to
Hello everybody !

I have a problem with SQL Server 7 or with Internet Information Server 5.

In fact, when I try to execute a lot of queries in one shot, sometimes I
have an error like that :

EOleException - Error code : -2147217871

The software I am developping is an Delphi 5 and XML application. So, The
exceptions EOle come from Delphi but I have no list of the error codes...

So, if someone can help me, it'll be very very very kind to me.

Thanks.

Oli.


0 new messages