Hello all..
I'm following along in the Professional DotNetNuke Module Programming book and I'm at the section where I update the 01.00.00.SqlDataProvider file. After completing the script I tested in SSMS by parsing it and I come up with several errors, Incorrect syntax near '{'., which appear to be mostly assoicated to the {databaseOwner} tag. I figured I missed something or the copy from the .pdf was not transfering over correctly so I when ahead and downloaded the code from the Wrox book site and that script gives me the same errors. I'm not sure what I'm missing or even if the script will error during the installation of the module but I wanted to see if anyone had any thoughts.
Code:
/************************************************************/
/***** SqlDataProvider *****/
/***** *****/
/***** *****/
/***** Note: To manually execute this script you must *****/
/***** perform a search and replace operation *****/
/***** for {databaseOwner} and {objectQualifier} *****/
/***** *****/
/************************************************************/
/** Create Table **/
if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]') and OBJECTPROPERTY(id, N'IsTable') = 1)
BEGIN
CREATE TABLE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
(
[ModuleId] [int] NOT NULL,
[EntryId] [int] NOT NULL IDENTITY(1, 1),
[SubmitterName] nvarchar(255) NOT NULL,
[SubmitterWebsite] nvarchar(255),
[SubmitterComment] ntext,
[SubmissionDate] DateTime NOT NULL,
[IsApproved] BIT NOT NULL
)
ALTER TABLE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
ADD CONSTRAINT [PK_{objectQualifier}DNNModuleProgramming_CS_Guestbook]
PRIMARY KEY CLUSTERED ([EntryId])
CREATE NONCLUSTERED INDEX [IX_{objectQualifier}DNNModuleProgramming_CS_Guestbook]
ON {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
([ModuleID])
ALTER TABLE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook] WITH NOCHECK
ADD CONSTRAINT [FK_{objectQualifier}DNNModuleProgramming_CS_Guestbook_{objectQualifier}Modules]
FOREIGN KEY ([ModuleID])
REFERENCES {databaseOwner}[{objectQualifier}Modules]
([ModuleID]) ON DELETE CASCADE NOT FOR REPLICATION
END
GO
/** Drop Existing Stored Procedures **/
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_InsertGuestbookEntry]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_InsertGuestbookEntry]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_ApproveGuestbookEntry]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_ApproveGuestbookEntry]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_DeleteGuestbookEntry]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_DeleteGuestbookEntry]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_GetApprovedEntries]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_GetApprovedEntries]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_GetAllEntries]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_GetAllEntries]
GO
/** Create Stored Procedures **/
CREATE PROCEDURE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_InsertGuestbookEntry]
@ModuleId INT,
@SubmitterName NVARCHAR(255),
@SubmitterWebsite NVARCHAR(255),
@SubmitterComment NTEXT,
@SubmissionDate DATETIME,
@IsApproved BIT
AS
INSERT INTO {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
(ModuleId, SubmitterName, SubmitterWebsite, SubmitterComment, SubmissionDate, IsApproved)
VALUES
(@ModuleId, @SubmitterName, @SubmitterWebsite, @SubmitterComment, @SubmissionDate, @IsApproved)
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_ApproveGuestbookEntry]
@ModuleId INT,
@EntryId INT
AS
UPDATE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
SET IsApproved = 1
WHERE ModuleId = @ModuleId
AND EntryId = @EntryId
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_DeleteGuestbookEntry]
@ModuleId INT,
@EntryId INT
AS
DELETE FROM {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
WHERE ModuleId = @ModuleId
AND EntryId = @EntryId
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_GetApprovedEntries]
@ModuleId INT
AS
SELECT
ModuleId,
EntryId,
SubmitterName,
SubmitterWebsite,
SubmitterComment,
SubmissionDate,
IsApproved
FROM {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
WHERE ModuleId = @ModuleId
AND IsApproved = 1
ORDER BY SubmissionDate DESC
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_GetAllEntries]
@ModuleId INT
AS
SELECT
ModuleId,
EntryId,
SubmitterName,
SubmitterWebsite,
SubmitterComment,
SubmissionDate,
IsApproved
FROM {databaseOwner}[{objectQualifier}DNNModuleProgramming_CS_Guestbook]
WHERE ModuleId = @ModuleId
ORDER BY SubmissionDate DESC
GO
/************************************************************/
/***** SqlDataProvider *****/
/************************************************************/