Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Simple example to display results of SQL query View modes: 
User avatar
Member
Member
treehan77-gmail - 7/26/2012 3:58:33 PM
   
Simple example to display results of SQL query
Can anyone give me a walk-thru of how to display as text a result of a SQL Query? I am using the Trial 6.0. I created a new page in the "Corporate" example website after installation. I then created a SQLDataSource. I believe it is connecting to it fine, since it localhost and i do not see any errors in the Site Management Dashbaord. My query works fine in SQL Management Studio too. The result is a CMS_User name, SteveG i think. I then added another Web part, Basic datalist and set it to use the ID from the SQLDataSource. I also unchecked the box that hides results if there are none, so if the query didn't work it should be displaying "No data found". This doesn't happen, but I also don't get any text displayed. Help! I have been unable to determine if I MUST use some kind of Transformation or setup something else. Thanks.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/30/2012 4:11:17 PM
   
RE:Simple example to display results of SQL query
You do need to create a transformation for your scenario to work. In v6, it's pretty simple to do. Just edit your Basic DataList web part instance configuration and choose the "New" button next to Item Transformation. Since you are not using a specific document type, you might want to just add your transformation to the "root" document type, so choose that document type from the dropdown list.

Next, name your template and choose your template type. If you want to make your template like you may have done before in .Net, use the ASCX type. You can then use <%# Eval("ColumnName") %> expressions to output your data.

I, however, prefer to use the Text/XML type and use K# Macros like {%ColumnName%} because the syntax is much simpler.

After you've created your transformation, you should be able to see your data.

User avatar
Member
Member
treehan77-gmail - 7/31/2012 8:18:40 AM
   
RE:Simple example to display results of SQL query
Thanks! Where can i find documentation regarding how to use / what all of the transformation properties are/do?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 8/1/2012 7:42:09 AM
   
RE:Simple example to display results of SQL query
Hello,

There is a lot of context help available throughout the UI of Kentico, try to use it in the parts, where you need help. Usually it contains also examples which are quite helpful. Additional information on K sharp can be found in our documentation. Useful information can be found in our CTO blog post. Additional documentation on macros is here and on transformations here.

Best regards,
Boris Pocatko