Getting DataSet is not in Edit Mode error for simple query with UNION....

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Japhar
Posts: 38
Joined: Thu 05 Oct 2006 04:22

Getting DataSet is not in Edit Mode error for simple query with UNION....

Post by Japhar » Mon 20 Nov 2006 12:52

Hi,

FYI: We are working with SDAC Licensed version....

I have a query component with below query:
Below query is just an example which i'm using in my project.

select groupno, pg_permission from #_usr_groups
union
select distinct '' as groupno, 'V' from usergrp


In FormCreate event i have following code:

MSQuery.Open; //working fine
MSQuery.Edit; //Throwing an error here...

MSQuery.fieldbyname('pg_permission').AsString := 'F';

Problem is when i say MSQuery.Edit, it is throwing an error that "DataSet is not in Edit mode". So why i'm getting an error when i do union with some other query?

Can you please suggest me how to over come this issue.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Mon 20 Nov 2006 16:13

SDAC SQL Generator doesn't support SELECT statements with UNION operation.
You have to specify INSERT, UPDATE and DELETE statements manually and in DataSet fields editor set TField.ReadOnly := False for all fields you want to edit.

Japhar
Posts: 38
Joined: Thu 05 Oct 2006 04:22

Post by Japhar » Fri 24 Nov 2006 04:59

Thanks for your support....Solved the problem.... :D

Post Reply