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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Errors in SqlDataProvider script execution during Module installErrors in SqlDataProvider script execution during Module install
Previous
 
Next
New Post
6/2/2008 4:11 AM
 

There are 2 problems I am facing in the execution of SqlDataProvider script execution during installation of my custom modules:

1) The scripts have statements that add Extended Properties to Schema objects. e.g. consider:

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The name of the course being offered.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'II_Course', @level2type=N'COLUMN',@level2name=N'Name'

The problem is that when I try to change @level0name=N'dbo' in the above statement to @level0name=N'{databaseowner}', while executing the script, it translates into dbo..ObjectName. And Sql Server complains that this object does not exist in the schema. The problem I guess, are 2 dots in the translated object name, one added by DNN while parsing {objectowner}, and the other by Sql Server, while executing the query. Is there any way to avoid the above problem, or would I need to hardcode the DB owner in the above statement, which would render it practically useless when the owner is not dbo.

 

2) I am getting errors in the execution of the script. A sample error is as follows:

Start Sql execution: 01.00.00.SqlDataProvider file
Failure SQL Execution resulted in following Exceptions: System.Data.SqlClient.SqlException: Incorrect syntax near 'Message: '. 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.DNNSqlDataProvider.ExecuteADOScript(String SQL) in G:\Projects\DNN\SqlDataProvider.vb:line 143 at DotNetNuke.Data.DNNSqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) in G:\Projects\DNN\SqlDataProvider.vb:line 437  ---- Here there is a Stored Procedure Create statement that I have shown below:

The stored procedure Create statement, where this error originates is as follows:

-- Create the stored procedure to generate an error using
-- RAISERROR. The original error information is used to
-- construct the msg_str for RAISERROR.
CREATE PROCEDURE {databaseOwner}{objectQualifier}[II_RethrowError] AS
    -- Return if there is no error information to retrieve.
    IF ERROR_NUMBER() IS NULL
        RETURN;

    DECLARE
        @ErrorMessage    NVARCHAR(4000),
        @ErrorNumber     INT,
        @ErrorSeverity   INT,
        @ErrorState      INT,
        @ErrorLine       INT,
        @ErrorProcedure  NVARCHAR(200);

    -- Assign variables to error-handling functions that
    -- capture information for RAISERROR.
    SELECT
        @ErrorNumber = ERROR_NUMBER(),
        @ErrorSeverity = ERROR_SEVERITY(),
        @ErrorState = ERROR_STATE(),
        @ErrorLine = ERROR_LINE(),
        @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-');

    -- Build the message string that will contain original
    -- error information.
    SELECT @ErrorMessage =
        N'Error %d, Level %d, State %d, Procedure %s, Line %d, ' +
            'Message: '+ ERROR_MESSAGE();
--Message: in the above line is where the error is being showed


    -- Raise an error: msg_str parameter of RAISERROR will contain
    -- the original error information.
    RAISERROR
        (
        @ErrorMessage,
        @ErrorSeverity,
        1,              
        @ErrorNumber,    -- parameter: original error number.
        @ErrorSeverity,  -- parameter: original error severity.
        @ErrorState,     -- parameter: original error state.
        @ErrorProcedure, -- parameter: original error procedure name.
        @ErrorLine       -- parameter: original error line number.
        );

I could not see any problem with this statement. What's more, the script file runs pefectly fine, when its content is copied & run thorugh "Sql" option in Host Menu.

I get many errors of this sort, but only when this script executes as a part of Module installation process. Am I missing something???

 
New Post
6/3/2008 5:32 AM
 

Okay, I got a solution to my second problem courtesy Mitchel Sellers.

The DataProvider files need to be in UTF-8 format, to get parsed by DNN correctly. How much I wish these small things about DNN to be documented in a better, and more visible ways to help save developer time & grief!!!


So, my second problem is solved. But the first one remain. How can I have Extended Properties in my SqlDataProvider files, without hard-coding the Database owner???

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Errors in SqlDataProvider script execution during Module installErrors in SqlDataProvider script execution during Module install


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