I've been creating a new module following the book DotNetNuke Module Programming and I'm running into some problems that it doesn't seem to have listed at all. I've created this module as a Web Site Project first and it all worked relatively fine. Now I'm trying to create it as a WAP to make it more secure and I'm running into problems.
When it was a WSP I was able to install the module but then I had to manuall create the Module Definition stating the controls associated with it. This was a pain and I noticed that in the WAP project that it has a .sqldataprovider file that is supposed to do that automatically. Well that seems to be my one big hold up. It throws me this error during installation:
SQL Execution resulted in following Exceptions: System.Data.SqlClient.SqlException: Error converting data type nvarchar to int. Cannot insert the value NULL into column 'DesktopModuleID', table 'devGPIntranet.dbo.dnn_ModuleDefinitions'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL) at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) /************************************************************/ /***** RegisterModule *****/ /***** *****/ /***** Use this script to register a module in the *****/ /***** database using Query Analyzer *****/ /***** *****/ /***** *****/ /***** Note: To manually execute this script you must *****/ /***** perform a search and replace operation *****/ /***** for dbo. and dnn_ *****/ /***** *****/ /************************************************************/ exec dbo.[dnn_AddDesktopModule] @PackageID = N'PackageID', @ModuleName = N'GPAwards', @FolderName = N'GPAwards', @FriendlyName = N'GPAwards', @Description = N'A GPAwards module', @Version = N'01.00.00', @IsPremium = 0, @IsAdmin = 0, @BusinessController = N'GP.Modules.GPAwards.GPAwardsController', @SupportedFeatures = 3 declare @DesktopModuleId int select @DesktopModuleId = [DesktopModuleId] from dbo.[dnn_DesktopModules] where ModuleName = 'GPAwards' exec dbo.[dnn_AddModuleDefinition] @DesktopModuleId, @FriendlyName = N'GPAwards', @DefaultCacheTime = 0 declare @ModuleDefID int select @ModuleDefID = [ModuleDefID] from dbo.[dnn_ModuleDefinitions] where FriendlyName = 'GPAwards' exec dbo.[dnn_AddModuleControl] @ModuleDefID, @ControlKey = NULL, @ControlTitle = NULL, @ControlSrc = N'DesktopModules/GPAwards/ViewGPAwards.ascx', @IconFile = NULL, @ControlType = 0, @ViewOrder = NULL, @HelpUrl = NULL, @SupportsPartialRendering = 1 exec dbo.[dnn_AddModuleControl] @ModuleDefID, @ControlKey = 'Edit', @ControlTitle = 'Edit Content', @ControlSrc = N'DesktopModules/GPAwards/EditGPAwards.ascx', @IconFile = NULL, @ControlType = 1, @ViewOrder = NULL, @HelpUrl = NULL, @SupportsPartialRendering = 1 exec dbo.[dnn_AddModuleControl] @ModuleDefID, @ControlKey = 'Settings', @ControlTitle = 'GPAwards Settings', @ControlSrc = N'DesktopModules/GPAwards/Settings.ascx', @IconFile = NULL, @ControlType = 1, @ViewOrder = NULL, @HelpUrl = NULL, @SupportsPartialRendering = 0
What I don't understand is where the data type varchar is coming from? Initially I hadn't changed anything about the file at all and it was throwing me this error. Then I put brackets around the table names thinking that it wasn't recognizing them as tables or something. That didn't work.
How can I get the Definition to be automatically installed instead of manually setting the definition?