Page 1 of 1

Exception error message is incomplete

Posted: Wed 07 Nov 2007 21:52
by llober
Using SDAC 4.10.xx

The message in an Exception is incomplete. For example, if I execute this, where second INSERT will be a duplicate record :

INSERT INTO MyTable (KeyField, OtherField) values ('xxx', 'test1')
INSERT INTO MyTable (KeyField, OtherField) values ('xxx', 'test2')


I get this error in the exception message :

The statement has been terminated.

When the full and complete message is :

Violation of PRIMARY KEY constraint 'PK_MyTable'. Cannot insert duplicate key in object 'dbo.MyTable'.
The statement has been terminated.

This renders the messages virtually useless !

How can I get the correct ( and complete ) message in the exception message ?

Regards,
Lluis Ollé

Posted: Thu 08 Nov 2007 01:04
by yeohray
Strange, but I could not reproduce the error. I did the following:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  f: Integer;
begin
  msquery1.SQL.Text := 'insert into test301 values (1, 1)  insert into test301 values (1, 1)';

  try
    msquery1.Execute;
  except
    on E: Exception do
    begin
      Log(E.Message);
    end;
  end;
end;
The error message raised was

Code: Select all

The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK__test301__5AEE82B9'. Cannot insert duplicate key in object 'test301'.
The only anomaly was that the order of the messages was reversed. I am using Delphi 7 with SDAC 4.10.0.10.

Posted: Fri 09 Nov 2007 10:08
by Antaeus
llober wrote:The message in an Exception is incomplete. For example, if I execute this, where second INSERT will be a duplicate record :

INSERT INTO MyTable (KeyField, OtherField) values ('xxx', 'test1')
INSERT INTO MyTable (KeyField, OtherField) values ('xxx', 'test2')


I get this error in the exception message :

The statement has been terminated.

When the full and complete message is :

Violation of PRIMARY KEY constraint 'PK_MyTable'. Cannot insert duplicate key in object 'dbo.MyTable'.
The statement has been terminated.
Try to download the last SDAC build (4.30.0.12), and check whether the problem is reproduced with it.
If the problem is still persists, send me please a complete small sample at sdac*crlab*com to demonstrate it, including script to create and fill table.
Also supply me the following information:
- exact version of your IDE;
- exact version of SQL Server and client. You can see it in the Info sheet of TMSConnection Editor.

Solved

Posted: Mon 12 Nov 2007 21:45
by llober
SDAC is working ok ... it was a problem with th eapplication.

Thanks
LLuis Olle