Accessing DotNetNuke Tables

As you know, DotNetNuke Database objects are named with a prefix that you supply during install and also you can setup a specific owner for all tables, stored procedures and other objects. In DotNetNuke you can use macros {databaseOwner} and {objectQualifier} inside SQL query. XsltDb also allow you to do that

mdo:sql('SELECT *
   FROM {databaseOwner}[{objectQualifier}DesktopModules]', 'mod')

see also mdo:sql documentation

If you use a SqlDataSource you can not use those macros. You have to use an mdo:dnn-prepare-sql() function to replace macros:

<xsl:variable name="sql">
   SELECT ModuleName, FriendlyName, Description
   FROM {databaseOwner}[{objectQualifier}DesktopModules]
</xsl:variable>
<asp:SqlDataSource
   id="dsModules"
   runat="server"
   DataSourceMode="DataReader"
   ConnectionString="&lt;%$ ConnectionStrings:SiteSqlServer %&gt;"
   SelectCommand="{mdo:dnn-prepare-sql($sql)}"
/>

See also SqlDataSource sample

Advertisements

About Anton Burtsev

Develop software since 2000
This entry was posted in XsltDb and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s