Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesCreating SQL module package with one click installationCreating SQL module package with one click installation
Previous
 
Next
New Post
5/1/2011 11:54 PM
 

Hello,

I have a simple module that uses one table (two columns).  I need to create a one click installation module package.  I have read some posts and came up with a small change.  I added an SQL provider file to my zip package which adds the table.  I also changed the sqlconnection in the ascx.vb file to the sql connection of the new site to which I need to install the package.  I understand that this is not going to be a "one click" installation with the hardcoded connection but just wanted to have it work before I tackle that issue.  The installation completed on the other site but after adding it to the site the module itself shows the following error.  Keep in mind this is my own module, not the blog module which seems to have a bug related to this error:



Error: UserComments is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: The server tag is not well formed. ---> System.Web.HttpParseException: The server tag is not well formed. ---> System.Web.HttpException: The server tag is not well formed. at System.Web.UI.TemplateParser.ProcessError(String message) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---

My ascx file:

%@ Control Language="VB" AutoEventWireup="false" CodeFile="UserComments.ascx.vb" Inherits="DesktopModules_UserComments_UserComments" %>
<asp:Label ID="Label1" runat="server"
    Text="Your comments are greatly appreciated"></asp:Label>
<p>
    <asp:TextBox ID="TextBox1" runat="server" Height="192px" Width="483px"></asp:TextBox>
</p>
<p>
    <asp:Button ID="Button1" runat="server" Text="Send" />
    <asp:Label ID="Label2" runat="server" Text=" "></asp:Label>
</p>
<p>
    <asp:Button ID="Button2" runat="server" Text="See all comments" />
</p>
<p>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="SqlConnection("data source = .\sql2008; Initial Catalog =dotnetnukedemo2; Integrated Security = True")"
        SelectCommand="SELECT * FROM [dnn_usercomments]"></asp:SqlDataSource>
</p>
<p>
    </p>

<asp:Panel ID="Panel1" runat="server" Height="229px" Visible="False">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource1"
    style="margin-top: 19px" BorderColor="Black" BorderStyle="None"
        ForeColor="Black">
        <Columns>
            <asp:BoundField DataField="comment" HeaderText="comment"
                SortExpression="comment" />
            <asp:BoundField DataField="date" HeaderText="date" SortExpression="date" />
        </Columns>
    </asp:GridView>
</asp:Panel>

My ascx.vb file
 

Imports DotNetNuke.Entities.Modules
Imports System
Imports System.Data
Imports System.Data.SqlClient
Partial Class DesktopModules_UserComments_UserComments
    Inherits PortalModuleBase

    Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cn As New SqlConnection("data source = .\sql2008; Initial Catalog =dotnetnukedemo2; Integrated Security = True")
        Dim comment As String
        Dim commentdate As Date
        Dim cmd As New SqlCommand
        cmd.Connection = cn

        comment = TextBox1.Text
        commentdate = System.DateTime.Now

        cn.Open()
        cmd.Parameters.Add(New SqlParameter("Comment", comment))
        cmd.Parameters.Add(New SqlParameter("Commentdate", commentdate))
        cmd.CommandText = "INSERT INTO dnn_usercomments (comment, date) VALUES (@comment, @commentdate)"
        cmd.ExecuteNonQuery()
        cn.Close()

    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Panel1.Visible = True
        Dim sqlresult As Object
        Panel1.Visible = True
        Dim cn As New SqlConnection("data source = .\sql2008; Initial Catalog =dotnetnukedemo2; Integrated Security = True")
        Dim cmd As New SqlCommand
        cmd.Connection = cn

        cn.Open()
        cmd.CommandText = "SELECT COUNT(*) AS RETURNCOUNT FROM dnn_usercomments"
        sqlresult = cmd.ExecuteScalar
        Dim count As Single = Convert.ToSingle(sqlresult)
        Panel1.Height = 22 * count
        cn.Close()

    End Sub
End Class


My dnn file

<dotnetnuke type="Package" version="5.0">
  <packages><package name="UserComments" type="Module" version="1.0.0">
  <friendlyName>UserComments</friendlyName>
  <description />
  <owner>
    <name>Jelena</name>
    <organization>Corymb</organization>
    <url />
    <email>jelena.hazlehurst@usa.com</email>
  </owner>
  <license>The license for this package is not currently included within the installation file, please check with the vendor for full license details.</license>
  <releaseNotes />
  <components>
  <component type="Script">
  <scripts>
  <script type="Install">
  <name>01.00.00.SqlDataProvider</name>
  <version>01.00.00</version>
  </script>
</scripts>
</component>

 

    <component type="Module">
      <desktopModule>
        <moduleName>UserComments</moduleName>
        <foldername>UserComments</foldername>
        <businessControllerClass />
        <supportedFeatures />
        <moduleDefinitions>
          <moduleDefinition>
            <friendlyName>UserComments</friendlyName>
            <defaultCacheTime>0</defaultCacheTime>
            <moduleControls>
              <moduleControl>
                <controlKey />
                <controlSrc>DesktopModules/UserComments/UserComments.ascx</controlSrc>
                <supportsPartialRendering>False</supportsPartialRendering>
                <controlTitle />
                <controlType>View</controlType>
                <iconFile />
                <helpUrl />
                <viewOrder>0</viewOrder>
              </moduleControl>
            </moduleControls>
          </moduleDefinition>
        </moduleDefinitions>
      </desktopModule>
    </component>
    <component type="File">
      <files>
        <basePath>DesktopModules\UserComments</basePath>
        <file>
          <name>UserComments.ascx</name>
        </file>
        <file>
          <name>UserComments.ascx.vb</name>
        </file>
      </files>
    </component>
  </components>
</package></packages>
</dotnetnuke>

My sql provider file:

/****** Object:  Table [dbo].[dnn_usercomments]    Script Date: 04/30/2011 20:24:45 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[dnn_usercomments](
 [comment] [text] NULL,
 [date] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO




 
New Post
5/2/2011 2:16 AM
 
Hi,

Can you please see my last post with all the detailed information on files I have used and the error received.  Can you help me figure out what i am doing wrong? 

Thanks,

Jelena
 
New Post
5/2/2011 4:04 AM
 
Jelena

As for me there is a problem:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="SqlConnection("data source = .\sql2008; Initial Catalog =dotnetnukedemo2; Integrated Security = True")" SelectCommand="SELECT * FROM [dnn_usercomments]"></asp:SqlDataSource>

In the ConnectionString you use double quotes for outer and inner the parametr. Probably it should be like:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='SqlConnection("data source = .\sql2008; Initial Catalog =dotnetnukedemo2; Integrated Security = True")' SelectCommand="SELECT * FROM [dnn_usercomments]"></asp:SqlDataSource>

Sergey 
 
PS: Would like to recommend you do not use SqlDataSource at the .ascx form. May be better to look to the good examples when project has well-orginized structure with DataProvider, SqlDataProvider and Business Logic.
 
New Post
5/2/2011 1:20 PM
 
Hi Sergey,

Thank you very much for your quick and helpful reply.  Changing the quotes helped get rid of the error and I was able to execute properly the first part of the app, insert a comment into the table.  However the second part where I try to display the data in the gridview gives me an error after:

A critical error has occurred.
Keyword not supported: 'sqlconnection ('data source'.

This is from the sqlconnection defined in the datagrid.  Not sure how to fix it now.  

I know my practice is not the best.  I am bran new at ASP.NET and DOTNETNUKE.  There is many things I have to learn and understand,.  Right now I am trying to figure out this package creation and then will be handed a big job of creating a real package for sale.  

  
 
New Post
5/2/2011 1:33 PM
 
Jelena

Please contact us and we will try to help you with this. Really without project in the Visual Studio it is hard to understand what causes error.

Sergey
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesCreating SQL module package with one click installationCreating SQL module package with one click installation


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out