Problem while inserting into TMSQuery.

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
NG_2005
Posts: 1
Joined: Tue 19 Jul 2005 10:56

Problem while inserting into TMSQuery.

Post by NG_2005 » Tue 19 Jul 2005 11:32

Hi!
I have Delphi6+TMSQuery+MSSQL7.
CursorType=ctKeyset
FetchAll=True
UpdatingTable=DOCBODIES
SQL='SELECT B.PartID,B.LineTS,B.ID,B.OBJECTID, B.Val, B.Price, B.VAL,
B.Price as Amount, o.assortimentname as name
FROM DOCBODIES B
LEFT JOIN OBJECTS O ON B.ObjectID=O.ID WHERE B.ID=:ID
order by b.objectid'
I have one record in [docbodies] and try to add one.
I was call
MSQuery1.insert
...
MSQuery1.post

and inserted string was disappear from my grid!
it was appear agane after MSQuery1.RefreshRecords
profiler shows this text:
sp_cursor 550133852, 4, 0, N'DOCBODIES', 10642, '00001411', 11., 1.00
go
sp_cursorfetch 550133852, 16, 2, 1
go
sp_cursorfetch 550133852, 16, 1, 1
go
sp_cursorfetch 550133852, 16, 2, 1
go
sp_cursorfetch 550133852, 16, 1, 1
go
sp_cursorfetch 550133852, 16, 1, 1
client calls sp_cursorfetch 3 times (2 on both records and last time only the first)
Answer, please, why does it 3 times and why does the record disappear?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 20 Jul 2005 11:39

> client calls sp_cursorfetch 3 times (2 on both records and last time only
> the first)


Most probably, it may be optimized. But on working with server cursors it is not important usually. We are planning in the further versions to review algorithm of fetching such cursors.

> why does the record disappear?

It is usual behaviour for ctKeyset. On opening this query an additional table is created at the server where all chosen records are enumerated. A new record is just added into this table. Please refer to MSDN for details.

> I have Delphi6+TMSQuery+MSSQL7.

MSSQL 7 doesn't support server cursors.

Guest

Post by Guest » Wed 20 Jul 2005 11:54

>MSSQL 7 doesn't support server cursors.
What do you mean?
What is SDAC doing while I'm using ctKeyset on mssql7?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 20 Jul 2005 14:07

SDAC pass a direction to use this cursor type OLE -> server. According to profiler, you connected to MS SQL Server 2000.

Guest

Post by Guest » Thu 21 Jul 2005 07:46

I hope, Im not crazy yet. I have been connected MSSQL7 during last three years every day.

Post Reply