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?
Problem while inserting into TMSQuery.
> 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.
> 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.