TMSQuery ReadOnly Bug

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 21
Joined: Fri 09 Nov 2007 23:29

TMSQuery ReadOnly Bug

Post by hmelihkara » Sun 20 Nov 2011 23:38

MSQuery does not update field readonly information correctly!
Please follow the steps:
1. Place TMSConnection on form
2. Place TMSQuery on form
3. Place TMSDataSource on form
4. Place TDBGrid on form
5. Connect MSDataSource to MSQuery and DBGrid to MSDataSource
6. Write some SELECT query inside MSQuery
7. Change Readonly propert of MSQuery to "TRUE"
8. Right click on MSQuery and open Fields Editor
9. Right click on Fields Editor and Add All Fields
10. Run Application and as a normal behavior you can not edit data.
11. Change MSQuery Readonly property to "FALSE" and the re-run application.
12. You still can not edit data! Cause the fields added, after changing readonly property to "TRUE", are still readonly.
To fix it you have to delete all fields from the field editor and then re-add them.


Post by AndreyZ » Mon 21 Nov 2011 14:17


When you set the TMSQuery.ReadOnly property to True and create persistent fields, SDAC sets the ReadOnly property of all persistent fields to True. When you set the TMSQuery.ReadOnly property to False, SDAC doesn't set the ReadOnly property of all persistent fields to False. There are two ways to avoid such situation:
- by creating persistent fields before setting the TMSQuery.ReadOnly property to True;
- by setting the ReadOnly property of all created persistent fields to False manually.

Post Reply