CREATE PROCEDURE dbo.GetModuleControlByKeyAndSrc
@ModuleDefId int,
@ControlKey nvarchar(50),
@ControlSrc nvarchar(256)
as
SELECT ModuleControlID,
ModuleDefID,
ControlKey,
ControlTitle,
ControlSrc,
IconFile,
ControlType,
ViewOrder
from dbo.ModuleControls
where ((ModuleDefId is null and @ModuleDefId is null) or (ModuleDefID = @ModuleDefID))
and ((ControlKey is null and @ControlKey is null) or (ControlKey = @ControlKey))
and ((ControlSrc is null and @ControlSrc is null) or (ControlSrc = @ControlSrc))
System.Data.SqlClient.SqlException: Must declare the scalar variable "@ModuleDefId".
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)
CREATE procedure dbo.UpdateModuleControl
@ModuleControlId int,
@ModuleDefID int,
@ControlKey nvarchar(50),
@ControlTitle nvarchar(50),
@ControlSrc nvarchar(256),
@IconFile nvarchar(100),
@ControlType int,
@ViewOrder int,
@HelpUrl nvarchar(200)
as
update dbo.ModuleControls
set ModuleDefId = @ModuleDefId,
ControlKey = @ControlKey,
ControlTitle = @ControlTitle,
ControlSrc = @ControlSrc,
IconFile = @IconFile,
ControlType = @ControlType,
ViewOrder = ViewOrder,
HelpUrl = @HelpUrl
where ModuleControlId = @ModuleControlId
System.Data.SqlClient.SqlException: Must declare the scalar variable "@FileId".
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)
CREATE PROCEDURE dbo.AddFile
@PortalID int,
@FileName nvarchar(100),
@Extension nvarchar(100),
@Size int,
@Width int,
@Height int,
@ContentType nvarchar(200),
@Folder nvarchar(200),
@FolderID int
AS
DECLARE @FileID int
SELECT @FileId = FileID FROM dbo.Files WHERE FolderID = @FolderID AND FileName = @FileName
IF @FileID IS Null
BEGIN
INSERT INTO dbo.Files (
PortalId,
FileName,
Extension,
Size,
Width,
Height,
ContentType,
Folder,
FolderID
)
VALUES (
@PortalID,
@FileName,
@Extension,
@Size,
@Width,
@Height,
@ContentType,
@Folder,
@FolderID
)
SELECT @FileID = SCOPE_IDENTITY()
END
ELSE
BEGIN
UPDATE dbo.Files
SET FileName = @FileName,
Extension = @Extension,
Size = @Size,
Width = @Width,
Height = @Height,
ContentType = @ContentType,
Folder = @Folder,
FolderID = @FolderID
WHERE FileId = @FileID
END
SELECT @FileID
System.Data.SqlClient.SqlException: Must declare the scalar variable "@ModuleID".
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)
create procedure dbo.GetSearchItem
@ModuleId int,
@SearchKey varchar(100)
AS
select
[SearchItemID],
[Title],
[Description],
[Author],
[PubDate],
[ModuleId],
[SearchKey],
[Guid],
[HitCount],
ImageFileId
from
dbo.SearchItem
where
[ModuleID] = @ModuleID AND
[SearchKey] = @SearchKey
System.Data.SqlClient.SqlException: Must declare the scalar variable "@Fields".
Must declare the scalar variable "@Fields".
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)
CREATE FUNCTION dbo.[GetProfileElement]
(
@fieldName AS NVARCHAR(100),
@fields AS NVARCHAR(4000),
@values AS NVARCHAR(4000)
)
RETURNS NVARCHAR(4000)
AS
BEGIN
-- If input is invalid, return null.
IF @fieldName IS NULL
OR LEN(@fieldName) = 0
OR @fields IS NULL
OR LEN(@fields) = 0
OR @values IS NULL
OR LEN(@values) = 0
RETURN NULL
-- locate FieldName in Fields
DECLARE @fieldNameToken AS NVARCHAR(20)
DECLARE @fieldNameStart AS INTEGER, @valueStart AS INTEGER, @valueLength AS INTEGER
-- Only handle string type fields (:S:)
SET @fieldNameStart = CHARINDEX(@fieldName + ':S',@Fields,0)
-- If field is not found, return null
IF @fieldNameStart = 0 RETURN NULL
SET @fieldNameStart = @fieldNameStart + LEN(@fieldName) + 3
-- Get the field token which I've defined as the start of the field offset to the end of the length
SET @fieldNameToken =
SUBSTRING(@Fields,@fieldNameStart,LEN(@Fields)-@fieldNameStart)
-- Get the values for the offset and length
SET @valueStart = dbo.getelement(1,@fieldNameToken,':')
SET @valueLength = dbo.getelement(2,@fieldNameToken,':')
-- Check for sane values, 0 length means the profile item was stored, just no data
IF @valueLength = 0 RETURN ''
-- Return the string
RETURN SUBSTRING(@values, @valueStart+1, @valueLength)
END
System.Data.SqlClient.SqlException: Must declare the scalar variable "@UserName".
Must declare the scalar variable "@RoleName".
Must declare the scalar variable "@RoleName".
Incorrect syntax near the keyword 'ELSE'.
Must declare the scalar variable "@RoleName".
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)
CREATE PROCEDURE dbo.GetUserRolesByUsername
@PortalID int,
@Username nvarchar(100),
@Rolename nvarchar(50)
AS
IF @UserName Is Null
BEGIN
SELECT R.*,
U.DisplayName As FullName,
UR.UserRoleID,
UR.UserID,
UR.EffectiveDate,
UR.ExpiryDate,
UR.IsTrialUsed
FROM dbo.UserRoles UR
INNER JOIN dbo.Users U ON UR.UserID = U.UserID
INNER JOIN dbo.Roles R ON R.RoleID = UR.RoleID
WHERE R.PortalId = @PortalID
AND (R.Rolename = @Rolename or @RoleName is NULL)
END
ELSE
BEGIN
IF @RoleName Is NULL
BEGIN
SELECT R.*,
U.DisplayName As FullName,
UR.UserRoleID,
UR.UserID,
UR.EffectiveDate,
UR.ExpiryDate,
UR.IsTrialUsed
FROM dbo.UserRoles UR
INNER JOIN dbo.Users U ON UR.UserID = U.UserID
INNER JOIN dbo.Roles R ON R.RoleID = UR.RoleID
WHERE R.PortalId = @PortalID
AND (U.Username = @Username or @Username is NULL)
END
ELSE
BEGIN
SELECT R.*,
U.DisplayName As FullName,
UR.UserRoleID,
UR.UserID,
UR.EffectiveDate,
UR.ExpiryDate,
UR.IsTrialUsed
FROM dbo.UserRoles UR
INNER JOIN dbo.Users U ON UR.UserID = U.UserID
INNER JOIN dbo.Roles R ON R.RoleID = UR.RoleID
WHERE R.PortalId = @PortalID
AND (R.Rolename = @Rolename or @RoleName is NULL)
AND (U.Username = @Username or @Username is NULL)
END
END
System.Data.SqlClient.SqlException: Must declare the scalar variable "@UrlTrackingID".
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)
create procedure dbo.GetUrlLog
@URLTrackingID int,
@StartDate datetime,
@EndDate datetime
as
select dbo.UrlLog.*,
'FullName' = dbo.Users.FirstName + ' ' + dbo.Users.LastName
from dbo.UrlLog
inner join dbo.UrlTracking on dbo.UrlLog.UrlTrackingId = dbo.UrlTracking.UrlTrackingId
left outer join dbo.Users on dbo.UrlLog.UserId = dbo.Users.UserId
where dbo.UrlLog.UrlTrackingID = @UrlTrackingID
and ((ClickDate >= @StartDate) or @StartDate is null)
and ((ClickDate <= @EndDate) or @EndDate is null)
order by ClickDate
System.Data.SqlClient.SqlException: Must declare the scalar variable "@EntryID".
Must declare the scalar variable "@EntryID".
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)
CREATE procedure dbo.DeleteListEntryByID
@EntryId int,
@DeleteChild bit
as
Delete
From dbo.Lists
Where [EntryID] = @EntryID
If @DeleteChild = 1
Begin
Delete
From dbo.Lists
Where [ParentID] = @EntryID
End
System.Data.SqlClient.SqlException: Must declare the scalar variable "@ModuleId".
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)
create procedure dbo.DeleteUrlTracking
@PortalID int,
@Url nvarchar(255),
@ModuleID int
as
delete
from dbo.UrlTracking
where PortalID = @PortalID
and Url = @Url
and ((ModuleId = @ModuleId) or (ModuleId is null and @ModuleId is null))
System.Data.SqlClient.SqlException: Cannot find the object 'GetProfileElement', because it does not exist or you do not have permission.
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)
GRANT EXECUTE ON dbo.[GetProfileElement] TO [public]