Creating Stored Procedure Scripts in DotNetNuke Modules

DotNetNuke is shipped with a number of feature-rich modules suitable for various tasks. However a necessity to modify a module’s behavior may arise. This article covers how to easily modify DNN modules and extend their behavior.

As a case in point, we will make minor modifications to the Blog module step by step But first let us clarify DotNetNuke's basic structure.

In DNN 4.x a module is usually comprised of front-end controls (in *.ascx files) and module’s logic (*.dll assemblies). A module’s front-end is located under DesktopModules\\ folder. The assemblies files can be found in Bin\ folder.



A stored procedure can be created by the means of the DotNetNuke SQL tool. Open it with Host > SQL menu item. Then paste the Storedprocedure creation query, select Run as Script and click Execute.

We ran a SQL script that created the table and the stored procedures.

You will notice that the script is written like:

CREATE TABLE {databaseOwner}[{objectQualifier}ThingsForSale]

rather than the normal:

CREATE TABLE [dbo][ThingsForSale]

The script commands "{databaseOwner}" and "{objectQualifier}" indicate that they are to be replaced by configuration settings in the web.config file. Normally "{databaseOwner}" is set to ".dbo" and "{objectQualifier}" is set to nothing (it would not have a setting). However, if alternate settings were indicated in the web.config file, those settings would be inserted into the script.

You must have the "Run as Script" box checked for this replacement to happen.

While logged into your DotNetNuke site as "host" in the web browser, from the menu bar select "Host". Then select "Module Definitions".

Click the black arrow that is pointing down to make the fly-out menu to appear. On that menu select "Create New Module".
Tags: , ,
Hot on Web:


About author