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é
Exception error message is incomplete
Strange, but I could not reproduce the error. I did the following:
The error message raised was
The only anomaly was that the order of the messages was reversed. I am using Delphi 7 with SDAC 4.10.0.10.
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;
Code: Select all
The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK__test301__5AEE82B9'. Cannot insert duplicate key in object 'test301'.
Try to download the last SDAC build (4.30.0.12), and check whether the problem is reproduced with it.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.
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.