Hello,
Please take a look at following code snippet that shows how you can create a new query and assign it to a given class specified in the
QueryClassId property:
CMS.SettingsProvider.Query q = new CMS.SettingsProvider.Query();
q.QueryName = <name>;
q.QueryClassId = <classId>;
q.QueryType = QueryTypeEnum.SQLQuery;
q.RequiresTransaction = <true/false>;
q.QueryText = <query text>;
CMS.SettingsProvider.QueryProvider.SetQuery(q);
For more information I would like to point yout to the API reference
Kentico CMS APIBest regards,
Michal Legen