Foreign key 'FK_dnn_wns_lightbox_moduleid' references invalid table 'dbo.Modules'

May 25, 2010 at 5:36 PM

http://wnslightbox.codeplex.com/Thread/View.aspx?ThreadId=70420

Still an issue?

I get this on install (WillStrohl.Lightbox_01.02.01_Install.zip):

SQL Execution resulted in following Exceptions: System.Data.SqlClient.SqlException: Foreign key 'FK_dnn_wns_lightbox_moduleid' references invalid table 'dbo.Modules'. Could not create constraint. See previous errors. 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) ALTER TABLE dbo.[dnn_wns_lightbox] WITH NOCHECK ADD CONSTRAINT [FK_dnn_wns_lightbox_moduleid] FOREIGN KEY ([ModuleId]) REFERENCES dbo.[Modules] ([ModuleId]) ON DELETE CASCADE NOT FOR REPLICATION

May 29, 2010 at 10:37 AM

On line 41 in file Providers\DataProviders\SqlDataProvider\01.00.00.SqlDataProvider.SqlDataProvider 

you need to add {objectQualifier} before Modules table name. 

here's the line corrected:

REFERENCES {databaseOwner}[{objectQualifier}Modules] ([ModuleId]) ON DELETE CASCADE NOT FOR REPLICATION

Coordinator
Oct 1, 2010 at 4:56 PM

FYI - this was fixed in a more recent update of the module as well.

Oct 11, 2010 at 9:58 AM
hismightiness wrote:

FYI - this was fixed in a more recent update of the module as well.

hismightiness,

it is NOT fixed in version 01.03.00 - I don't know which update is more recent. Funny that I already reported that about a year ago, and with the latest version, this bug is back... (don't know if it was fixed somewhen in between). You should ask Matthias Schlomann from the German Usergroup to review your .SqlDataProvider files ;-)

Best wishes
Michael

Coordinator
Oct 14, 2010 at 2:42 AM

I am not sure why your upgrade scripts did not run properly, but this WAS fixed in version 01.00.01 and has worked fine since.  If you doubt this, the project is open source.  You can check the previous downloads and the change sets in the source code.  It's there.  Your upgrade scripts not executing properly could have happened for any number of reasons.  I am sorry.  If you run the 01.00.01.SqlDataProvider script in the SQL module (found in the Host menu), you can manually fix this now.