Page 1 of 1

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

Posted: Mon 20 Nov 2006 12:52
by Japhar
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.

Posted: Mon 20 Nov 2006 16:13
by Jackson
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.

Posted: Fri 24 Nov 2006 04:59
by Japhar
Thanks for your support....Solved the problem.... :D