Weird behavior of TMSQuery with CheckBrowseMode

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Weird behavior of TMSQuery with CheckBrowseMode

Post by brace » Thu 19 Feb 2015 08:51

Hello.

I tipically use TMSQuery with cachedupdates and this code usually works fine:

Code: Select all

MyMainQuery.Edit;
MyMainQueryFIELD_ONE.AsString := MySourceQueryFIELD_ONE.AsString;
MyMainQueryFIELD_TWO.AsInteger := MySourceQueryFIELD_TWO.AsInteger; //but here this time i have exception!!!
MyMainQueryFIELD_THREE.AsString := MySourceQueryFIELD_THREE.AsString;
MyMainQueryFIELD_FOUR.AsString := MySourceQueryFIELD_FOUR.AsString;
MyMainQueryFIELD_FIVE.AsString := MySourceQueryFIELD_FIVE.AsString;
MyMainQueryFIELD_SIX.AsString := MyMainQueryFIELD_SIX.AsString;
MyMainQuery.CheckBrowseMode;
but as i wrote above i have an exception "Dataset not in edit mode".

I tried this workaroudn and it works fine:

Code: Select all

MyMainQuery.Edit;
MyMainQueryFIELD_ONE.AsString := MySourceQueryFIELD_ONE.AsString;
MyMainQuery.CheckBrowseMode;
MyMainQuery.Edit;
MyMainQueryFIELD_TWO.AsInteger := MySourceQueryFIELD_TWO.AsInteger;
MyMainQuery.CheckBrowseMode;
MyMainQuery.Edit;
MyMainQueryFIELD_THREE.AsString := MySourceQueryFIELD_THREE.AsString;
MyMainQuery.CheckBrowseMode;
MyMainQuery.Edit;
MyMainQueryFIELD_FOUR.AsString := MySourceQueryFIELD_FOUR.AsString;
MyMainQuery.CheckBrowseMode;
MyMainQuery.Edit;
MyMainQueryFIELD_FIVE.AsString := MySourceQueryFIELD_FIVE.AsString;
MyMainQuery.CheckBrowseMode;
MyMainQuery.Edit;
MyMainQueryFIELD_SIX.AsString := MyMainQueryFIELD_SIX.AsString;
MyMainQuery.CheckBrowseMode;
Basically calling ChcekbrowseMode and Edit after evrey assignment it works.

Could you please guide me and suggesting why i have this behavior on a specific dataset after i did the same for years?

I use SDAC 6.1.6
Thank you.

azyk
Devart Team
Posts: 1058
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Weird behavior of TMSQuery with CheckBrowseMode

Post by azyk » Thu 19 Feb 2015 13:05

We couldn't reproduce the problem. Please, try to compose a small sample to demonstrate the problem including a script to create test tables and send it to andreyz*devart*com .

Post Reply