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 ---
This is my dnn file:
UserComments
Jelena
Corymb
jelena.hazlehurst@usa.com
The license for this package is not currently included within the installation file, please check with the vendor for full license details.
UserComments
UserComments
UserComments
0
DesktopModules/UserComments/UserComments.ascx
False
View
0
DesktopModules\UserComments
UserComments.ascx
UserComments.ascx.vb
This is my ascx file:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="UserComments.ascx.vb" Inherits="DesktopModules_UserComments_UserComments" %>
Text="Your comments are greatly appreciated">
ConnectionString="SqlConnection("data source = .\sql2008; Initial Catalog =dotnetnukedemo2; Integrated Security = True")"
SelectCommand="SELECT * FROM [dnn_usercomments]">
DataSourceID="SqlDataSource1"
style="margin-top: 19px" BorderColor="Black" BorderStyle="None"
ForeColor="Black">
SortExpression="comment" />
This is 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
This is my sqlprovider 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