Ignore warnings

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
palmtreefrb
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Ignore warnings

Post by palmtreefrb » 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?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 19 Oct 2007 07:58

Do you mean this error message?
Update failed. Found 0 records.
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
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Fri 19 Oct 2007 14:25

Warning: Duplicate key was ignored.'
Antaeus wrote:Do you mean this error message?
Update failed. Found 0 records.
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
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Fri 19 Oct 2007 14:32

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?
Update failed. Found 0 records.
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
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Fri 19 Oct 2007 14:45

I should indicate I am using the TMSQuery to insert records in both cases.
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.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 22 Oct 2007 07:51

I could not reproduce the problem.
Please send me a complete small sample at sdac*crlab*com to demonstrate it, including script to create table.

Also supply me the following information:
- exact version of SDAC. You can see it in the About sheet of TMSConnection Editor;
- exact version of your IDE;
- exact version of SQL Server and client. You can see it in the Info sheet of TMSConnection Editor.

palmtreefrb
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Thu 25 Oct 2007 15:32

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
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Thu 25 Oct 2007 15:34

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"

palmtreefrb
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Thu 25 Oct 2007 15:38

Provider...
Microsoft SQL Server: 09.00.3042
Microsoft OLE DB Provider for SQL Server: 08.00.1117
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"

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 26 Oct 2007 07:03

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;

palmtreefrb
Posts: 13
Joined: Fri 12 Nov 2004 21:06

Post by palmtreefrb » Mon 29 Oct 2007 18:11

Thanks,
Is there a single dll of the new native client that I can include in the application directory. Older versions of the native client I could include ntwdblib.dll. What is the name of the new native client dll?
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;

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 30 Oct 2007 15:59

I do not think that there is a way to install SQL Native Client just by coping certain files. Anyway we cannot guarantee that SDAC will work properly in this case.

Post Reply