API Questions on Kentico API.
Version 6.x > API > Events - CONTENT_BookingEvent View modes: 
User avatar
Member
Member
brendan-ignitedcoder - 10/3/2012 8:52:02 AM
   
Events - CONTENT_BookingEvent
I'm building a custom set of pages to list events using the jquery slider, I've got everything setup to use my master page and all of my detail pages are all laid out and ready for some data. I've got a few files all set with the backend C# classes also ready to go. Now all thats left is for a kind soul to point to some very simple code I can use to query the CONTENT_BookingEvent table so I can grab the data related to our events and show them in my pages. Note I am using MVC and its working great on Kentico 6.X...

All I need is a simple way to query the top n events or filter an event by id so I can show some details..... Someone please give me a snippet of code to start with, unfortunately the documentation though lengthy does not make this clear.

Thanks,
Brendan

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/4/2012 4:35:13 AM
   
RE:Events - CONTENT_BookingEvent
Hi Brendan,

I would recommend you to use the Select TOP N clause in your query:
SELECT TOP number|percent column_name(s)
FROM table_name
I hope this will help you.

Best regards,
Martin Danko

User avatar
Member
Member
brendan-ignitedcoder - 10/4/2012 7:05:07 AM
   
RE:Events - CONTENT_BookingEvent
Hi Martin,

Thanks for responding... I have the SQL I need, whats missing is how to call it using the ExecuteQuery function API call. I could also just use ADO directly against the table but figured there was a way to do it using the Kentico Built in API. I just cant find the documentation on it.

Thanks
Brendan

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/4/2012 7:32:54 AM
   
RE:Events - CONTENT_BookingEvent
Hi Brendan,

Please, try the following code :
QueryDataParameters parameters = new QueryDataParameters();

GeneralConnection cn = ConnectionHelper.GetConnection();

DataSet ds =ConnectionHelper.ExecuteQuery("your_query i.e. SELECT TOP N FROM...", parameters, QueryTypeEnum.SQLQuery, true);

Best regards,
Martin Danko

User avatar
Member
Member
brendan-ignitedcoder - 10/4/2012 8:48:00 AM
   
RE:Events - CONTENT_BookingEvent
Martin,

Most excellent, works great, thanks, You rock!

Brendan