Problem with insert, autorefresh

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
igor
Posts: 3
Joined: Fri 13 Nov 2009 11:14

Problem with insert, autorefresh

Post by igor » Mon 16 Nov 2009 08:14

Hello.
I use delphi 7, MS SQL server 2005 and try to use other version of sdac.

When set compatibility level 80 on database all good. When I insert record into view, I see id of new record and i can to update or delete this record.

When set compatibility level 90 I have a problem. When I insert record into view, I don't see id of new record on old version of sdac (3.80) and on new version i have error (refresh faild. Found 0 records)

I can't use manual insert and refresh because i have big project with use sdac 3.80.

Anyone have ideas how i can use compatibility level 90 and sdac

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 17 Nov 2009 09:42

I can not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill a table.

igor
Posts: 3
Joined: Fri 13 Nov 2009 11:14

Post by igor » Tue 17 Nov 2009 12:29

I send email with small example to dmitryg*devart*com.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 18 Nov 2009 13:22

Thank you for information.

The problem is that when you insert record in view, then a new value of autoincrement field is not returned, and in refresh query the NULL value is included.
To solve the problem you should set the SQLRefresh property, like this:

Code: Select all

SELECT Id, name, productCatId
FROM products
WHERE name = :name and productCatId = :productCatId

igor
Posts: 3
Joined: Fri 13 Nov 2009 11:14

Post by igor » Mon 23 Nov 2009 12:08

Thank you for answer.

But it is not a good solution for my problem. Because I don't want to rewrite all msqueries in my project.

Maybe you know why all work when i set compatibility level 80. Maybe possible modify source of SDAC to solve the problem?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 24 Nov 2009 09:05

Different behaviour of SDAC is connected with different behaviour of SQL Server. The point is that SQL Server with compatibility level 80 returns information about autoincrement fields, and with compatibility level 90 does not return this information.

Post Reply