Hi,
I have the following problem in DNN 4.5.3
I'm trying to install one of my modules, where a 02.00.00.SqlDataProvider script is included with the following content
CREATE PROCEDURE {databaseOwner}{objectQualifier}DC_Skelet_GetRecordCount
@TableName NVARCHAR(50),
@QueryFilter NVARCHAR(100) = NULL
AS
BEGIN
SET NOCOUNT ON
IF @QueryFilter IS NULL OR @QueryFilter = ''
EXEC('SELECT COUNT(*) AS RecordCount FROM ' + @TableName)
ELSE
EXEC('SELECT COUNT(*) AS RecordCount FROM ' + @TableName + ' WHERE ' + @QueryFilter)
SET NOCOUNT OFF
END
GO
When I try to run this script via Host -> SQL, the script executes as expected by calling SqlDataProvider.ExecuteADOScript(...) in SqlDataProvider.vb
When I install the package via Host -> , the PaDnnInstallerBase class executes the BatchSql method. One of the first things is converting the SQL script from UTF7 to ASCII by calling the GetAsciiString() method. The result from this call is the above SQL script minus the '+' characters around @TableName and @QueryFilter:
CREATE PROCEDURE {databaseOwner}{objectQualifier}DC_Skelet_GetRecordCount
@TableName NVARCHAR(50),
@QueryFilter NVARCHAR(100) = NULL
AS
BEGIN
SET NOCOUNT ON
IF @QueryFilter IS NULL OR @QueryFilter = ''
EXEC('SELECT COUNT(*) AS RecordCount FROM ' @TableName)
ELSE
EXEC('SELECT COUNT(*) AS RecordCount FROM ' @TableName ' WHERE ' @QueryFilter)
SET NOCOUNT OFF
END
GO
Therefore, the SQL statement failes...
Is there a workaround for this problem or am I doing something wrong?
Thx
Alain