No refresh joined field after insert

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Alexander_73
Posts: 52
Joined: Mon 24 Mar 2008 13:22

No refresh joined field after insert

Post by Alexander_73 » Wed 09 Apr 2008 12:20

Object TMSQuery, RefreshOptions=[roAfterInsert,roAfterUpdate],
Options.UpdateAllFields:=true

SQL Text:

Code: Select all

SELECT A.*, S.SendTypeName FROM AllFirmAddresses A
LEFT JOIN AA_LetterSendTypes S ON S.SendTypeID=ISNULL(A.SendTypeID,0)
WHERE FirmID=:FirmID
ORDER BY AddDate DESC, FirmName ASC
Insert SQL:

Code: Select all

INSERT INTO [AllFirmAddresses]
  ([FirmID], [FirmName], [Index], [Address], [Contact], [Note], [IsDefault], [AddDate], [SendTypeID])
VALUES
 :[FirmID], :[FirmName], :[Index], :[Address], :[Contact], :[Note], :[IsDefault], :[AddDate], :[SendTypeID])
SET :[ID] = SCOPE_IDENTITY()
Refresh SQL:

Code: Select all

SELECT A.*, S.SendTypeName FROM [AllFirmAddresses] A
LEFT JOIN AA_LetterSendTypes S ON S.SendTypeID=ISNULL(A.SendTypeID,0)
WHERE
  A.[ID] = :[ID]
After inserting of new record (Query.Insert) and posting (Query.Post) record appears in the DBGrid, but column SendTypeName remains empty until the Query will not be closed and opened again. At Editing (Query.Edit) and posting (Query.Post) the column SendTypeName changes at once. How to receive value of a column without reopening query?

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

Post by Antaeus » Wed 09 Apr 2008 14:37

I could not reproduce the problem.
Please send me a complete small sample at sdac*crlab*com to demonstrate it, including script to create and fill 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.

Post Reply