Ignore warnings
Posted: Fri 19 Oct 2007 06:07
I have my table set to ignore duplicate keys. However the warning is raised as an exception from TMSQuery. How do I evaluate warnings from true exceptions. Can I ignore warnings with SDAC?
Discussion forums for open issues and questions concerning database tools, data access components and developer tools from Devart
https://forums.devart.com/
If you do, you should set the StrictUpdate option of TMSQuery to false to get rid of it.Update failed. Found 0 records.
Antaeus wrote:Do you mean this error message?If you do, you should set the StrictUpdate option of TMSQuery to false to get rid of it.Update failed. Found 0 records.
If you get another message, please post its exact text. Also describe in more details, in what situation does it arise.
palmtreefrb wrote:'Warning: Duplicate key was ignored.'
Antaeus wrote:Do you mean this error message?If you do, you should set the StrictUpdate option of TMSQuery to false to get rid of it.Update failed. Found 0 records.
If you get another message, please post its exact text. Also describe in more details, in what situation does it arise.
palmtreefrb wrote:Also, another "Warning" that other Data Access components would not raise an error on is...
The statement has been terminated.'String or binary data would be truncated.'
palmtreefrb wrote:'Warning: Duplicate key was ignored.'
Antaeus wrote:Do you mean this error message? If you do, you should set the StrictUpdate option of TMSQuery to false to get rid of it.
If you get another message, please post its exact text. Also describe in more details, in what situation does it arise.
palmtreefrb wrote:It is easy to reproduce. Just create a Unique Key and set the properties to "Ignore Duplicate Keys".
CREATE UNIQUE NONCLUSTERED INDEX [IX_mytable] ON [dbo].[mytable]
(
[DATE_BATCH] ASC
)WITH (IGNORE_DUP_KEY = ON) ON [PRIMARY]
Then from TMSQuery insert a record into table with a duplicate key. It will raise an "Error" for the "Warning"
palmtreefrb wrote:Sorry Forgot...
SQL Server 2005
SDAC ver 4.30.0.12 Delphi 6
palmtreefrb wrote:It is easy to reproduce. Just create a Unique Key and set the properties to "Ignore Duplicate Keys".
CREATE UNIQUE NONCLUSTERED INDEX [IX_mytable] ON [dbo].[mytable]
(
[DATE_BATCH] ASC
)WITH (IGNORE_DUP_KEY = ON) ON [PRIMARY]
Then from TMSQuery insert a record into table with a duplicate key. It will raise an "Error" for the "Warning"
Code: Select all
if e.ErrorCode = 3604 then
Fail := False;
Antaeus wrote:I reproduced this problem. I can suggest you the following ways to avoid it:
1) Install SQL Server Native Client and make sure that SDAC uses it (provider version must be 09.xx.xxxxx).
2) Place the following code to the TMSConnection.OnError event handler:Code: Select all
if e.ErrorCode = 3604 then Fail := False;