Access Violation in msado15.dll (D5/ADO/DB2) Sequel
On the 08/29/2001 I posted that problem (see my original message here in
after) and did not find a solution at that time.
Today I have a solution. Instead of using a TAdoQuery do it with a
TAdoConnection like this :
Var SqlCmd : String;
Begin
SqlCmd := 'INSERT INTO MyTable ( Col1, Col2 ...) VALUES (Val1, Val2
...)';
Try
Ado_Connect.BeginTrans;
Ado_Connect.Execute( SqlCmd, cmdText, [eoExecuteNoRecords] );
Ado_Connect.CommitTrans;
Except
Display_ConnectionErrors(Ado_Connect);
Ado_Connect.RollbackTrans;
End;
End
Now I still have a question : where is the bug ? In Borland components ? In
MDAC ? In IBM Provider ?
My original message was (on 08/29/2001)
"I am working with Windows 2000 pro, Delphi 5 Last update, ADO Express
update2, MDAC 2.6 sp1 and IBM DB2 V7.1 last update (which is 7.2 in fact as
they say).
When I am trying to insert a new record with an ADO query (INSERT INTO
Table...), it works fine. But when the record already exists, I get the
message "Exception EAccessViolation in msado15.dll ..." only when I quit
the program (very strange). The code is something like that :
// MyQuery.SQL = INSERT
INTO AFFAIRE ( NOAFFAIRE, DCREATION)
VALUES ( :NoAff ,
:Dcreation)
// NOAFFAIRE is the PK.
With MyQuery Do Begin
Parameters.ParamByName('NoAff').Value := P1;
Parameters.ParamByName('Dcreation').Value :=
FormatDateTime('yyyy-mm-dd', Date);
Try
{Prepared := True} // With or whithout prepared same problem.
ExecSQL; // Exception here
Except
Message ... // This instruction is never reached when trying
to insert a duplicate record
End;
End;
Does anybody knows what is wrong with my code ? or perhaps with Microsoft ?
--
Cordialement
Rgis CLUSEAU
r.clus...@datasoft.fr