• 一个DNN安装时的未知错误


    今天在做DNN的一个模块的安装包时遇到一个莫明的错误,数据库的安装文件运行时总是出现错误,以下是我的数据库安装文件。我直接用DNN中的SQL服务作为脚本运行 是没有问题的,但安装时出错。
     /************************************************************/ 
    /*****              SQLDataProvider                     *****/
    /*****              Article                  *****/
    /*****                                                  *****/
    /***** Note: To manually execute this script you must   *****/
    /*****       perform a search and replace operation     *****/
    /*****       for {databaseOwner} and {objectQualifier}  *****/
    /*****                                                  *****/
    /************************************************************/

    /*****        My Function                *****/
    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}f_splitstr]'and xtype in (N'FN', N'IF', N'TF'))
    drop function {databaseOwner}[{objectQualifier}f_splitstr]
    GO

    /*****        Procedure                *****/
    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_AccesoryGet]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_AccesoryGet]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_AccesoryListByArticleId]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_AccesoryListByArticleId]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleAdd]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleAdd]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleAndAccesoryUpdate]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleAndAccesoryUpdate]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleDelete]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleDelete]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleGet]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleGet]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleGetByCategory]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleGetByCategory]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleGetRcount]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleGetRcount]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleGetRcountByCategory]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleGetRcountByCategory]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleGetRcountByDateCategory]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleGetRcountByDateCategory]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleList]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleList]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleSignedAdd]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleSignedAdd]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleSignedUsers]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleSignedUsers]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleUnSignedGetByUser]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleUnSignedGetByUser]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleUnSignedUsers]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleUnSignedUsers]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleUpdate]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_ArticleUpdate]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_GetCount]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_GetCount]
    GO

    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_GetPagingData]'and OBJECTPROPERTY(id, N'IsProcedure'= 1)
    drop procedure {databaseOwner}[{objectQualifier}gdlmo_GetPagingData]
    GO

    /****** Object:  Table {databaseOwner}[{objectQualifier}gdlmo_Article]    Script Date: 2007-12-17 8:59:40 ******/
    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_Article]'and OBJECTPROPERTY(id, N'IsUserTable'= 1)
    drop table {databaseOwner}[{objectQualifier}gdlmo_Article]
    GO

    /****** Object:  Table {databaseOwner}[{objectQualifier}gdlmo_ArticleSigned]    Script Date: 2007-12-17 8:59:40 ******/
    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_ArticleSigned]'and OBJECTPROPERTY(id, N'IsUserTable'= 1)
    drop table {databaseOwner}[{objectQualifier}gdlmo_ArticleSigned]
    GO

    /****** Object:  Table {databaseOwner}[{objectQualifier}gdlmo_Article_Accesory]    Script Date: 2007-12-17 8:59:40 ******/
    if exists (select * from {databaseOwner}{objectQualifier}sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}gdlmo_Article_Accesory]'and OBJECTPROPERTY(id, N'IsUserTable'= 1)
    drop table {databaseOwner}[{objectQualifier}gdlmo_Article_Accesory]
    GO

    /****** Object:  Table {databaseOwner}[{objectQualifier}gdlmo_Article]    Script Date: 2007-12-17 8:59:42 ******/
    CREATE TABLE {databaseOwner}[{objectQualifier}gdlmo_Article] (
        
    [ArticleID] [int] IDENTITY (11NOT NULL ,
        
    [CategoryID] [int] NULL ,
        
    [Title] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [CreatedDate] [smalldatetime] NULL ,
        
    [CreatedByUser] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [CopyFrom] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [Author] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [Hits] [int] NULL ,
        
    [IsPassed] [bit] NULL ,
        
    [IP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [DeptName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [Summary] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL 
    ON [PRIMARY]
    GO

    /****** Object:  Table {databaseOwner}[{objectQualifier}gdlmo_ArticleSigned]    Script Date: 2007-12-17 8:59:44 ******/
    CREATE TABLE {databaseOwner}[{objectQualifier}gdlmo_ArticleSigned] (
        
    [ArticleSignedId] [int] IDENTITY (11NOT NULL ,
        
    [UserId] [int] NOT NULL ,
        
    [ArticleId] [int] NOT NULL ,
        
    [SignedDate] [datetime] NULL 
    ON [PRIMARY]
    GO

    /****** Object:  Table {databaseOwner}[{objectQualifier}gdlmo_Article_Accesory]    Script Date: 2007-12-17 8:59:44 ******/
    CREATE TABLE {databaseOwner}[{objectQualifier}gdlmo_Article_Accesory] (
        
    [AccesoryId] [int] IDENTITY (11NOT NULL ,
        
    [ArticleId] [int] NOT NULL ,
        
    [ArticleName] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
        
    [IsActive] [bit] NULL 
    ON [PRIMARY]
    GO


    ALTER TABLE {databaseOwner}[{objectQualifier}gdlmo_Article] WITH NOCHECK ADD 
        
    CONSTRAINT [PK{objectQualifier}_gdlmo_Article] PRIMARY KEY  CLUSTERED 
        (
            
    [ArticleID]
        )  
    ON [PRIMARY] 
    GO

    ALTER TABLE {databaseOwner}[{objectQualifier}gdlmo_ArticleSigned] WITH NOCHECK ADD 
        
    CONSTRAINT [PK{objectQualifier}_gdlmo_ArticleSigned] PRIMARY KEY  CLUSTERED 
        (
            
    [ArticleSignedId]
        )  
    ON [PRIMARY] 
    GO

    ALTER TABLE {databaseOwner}[{objectQualifier}gdlmo_Article_Accesory] WITH NOCHECK ADD 
        
    CONSTRAINT [PK{objectQualifier}_gdlmo_Article_Accesory] PRIMARY KEY  CLUSTERED 
        (
            
    [AccesoryId]
        )  
    ON [PRIMARY] 
    GO

    CREATE function f_splitstr
    (
      
    @SourceSql varchar(8000),
      
    @StrSeprate varchar(10)
    )
    returns @temp table(F1 varchar(100))
    as 
    begin
      
    declare @i int
       
    set @SourceSql=rtrim(ltrim(@SourceSql))
       
    set @i=charindex(@StrSeprate,@SourceSql)
       
    while @i>=1
       
    begin
         
    insert @temp values(left(@SourceSql,@i-1))
         
    set @SourceSql=substring(@SourceSql,@i+1,len(@SourceSql)-@i)
         
    set @i=charindex(@StrSeprate,@SourceSql)
       
    end
       
    if @SourceSql<>'' 
         
    insert @temp values(@SourceSql)
       
    return 
    end

    GO

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_AccesoryGet
        
    @AccesoryID int
    AS

    SELECT
        
    [AccesoryId]
        
    [ArticleId]
        
    [ArticleName] 
    FROM gdlmo_Article_Accesory
    WHERE [AccesoryId] = @AccesoryId

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_AccesoryListByArticleId    Script Date: 2007-6-20 21:28:27 ******/
    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_AccesoryListByArticleId
        
    @ArticleId int
    AS

    SELECT 
        
    [AccesoryId]
        
    [ArticleId]
        
    [ArticleName] 
    FROM gdlmo_Article_Accesory
    WHERE [ArticleId] = @ArticleId

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleDelete    Script Date: 2007-6-20 21:28:27 ******/

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleDelete
        
    @ArticleID int
    AS

    DELETE FROM {databaseOwner}{objectQualifier}gdlmo_Article
    WHERE
        
    [ArticleID] = @ArticleID


    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleGet    Script Date: 2007-6-20 21:28:27 ******/

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleGet
        
    @ArticleID int
        
    AS

    SELECT
        
    [ArticleID],
        
    [CategoryID],
        
    [Title],
        
    [CreatedDate],
        
    [CreatedByUser],
        
    [CopyFrom],
        
    [Author],
        
    [Hits],
        
    [IsPassed],
        
    [IP],
        
    [DeptName],
        
    [Summary]
    FROM gdlmo_Article
    WHERE
        
    [ArticleID] = @ArticleID

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleGetByCategory    Script Date: 2007-6-20 21:28:27 ******/

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleGetByCategory
        
    @CategoryID int
    AS

    SELECT
        
    [ArticleID],
        
    [CategoryID],
        
    [Title],
        
    [CreatedDate],
        
    [CreatedByUser],
        
    [CopyFrom],
        
    [Author],
        
    [Hits],
        
    [IsPassed],
        
    [IP],
        
    [DeptName],
        
    [Summary]
    FROM gdlmo_Article
    WHERE
        
    [CategoryID]=@CategoryID

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleGetRcount    Script Date: 2007-6-20 21:28:27 ******/
    CREATE PROCEDURE {databaseOwner}{objectQualifier}[gdlmo_ArticleGetRcount] 
    AS
        
    SELECT COUNT(*AS ArticleCount
        
    FROM {databaseOwner}{objectQualifier}gdlmo_Article
        
    RETURN

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleGetRcountByCategory    Script Date: 2007-6-20 21:28:27 ******/
    CREATE PROCEDURE {databaseOwner}{objectQualifier}[gdlmo_ArticleGetRcountByCategory] 
        
    @CategoryID int
    AS
        
    SELECT COUNT(*AS ArticleCount
        
    FROM {databaseOwner}{objectQualifier}gdlmo_Article
        
    where CategoryID = @CategoryID
        
    RETURN

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleGetRcountByDateCategory    Script Date: 2007-6-20 21:28:27 ******/
    CREATE PROCEDURE {databaseOwner}{objectQualifier}[gdlmo_ArticleGetRcountByDateCategory] 
        
    @CategoryID int,
        
    @StartDate  smalldatetime,
        
    @EndDate smalldatetime
    AS
        
    SELECT COUNT(*AS ArticleCount
        
    FROM {databaseOwner}{objectQualifier}gdlmo_Article
        
    where ((CategoryID = @CategoryIDand (CreatedDate between @StartDate and @EndDate))
        
    RETURN

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleList    Script Date: 2007-6-20 21:28:27 ******/

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleList
    AS

    SELECT
        
    [ArticleID]
        
    [CategoryID]
        
    [Title]
        
    [CreatedDate]
        
    [CreatedByUser]
        
    [CopyFrom]
        
    [Author]
        
    [Hits]
        
    [IsPassed]
        
    [IP]
        
    [DeptName]
        
    [Summary]
    FROM gdlmo_Article

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleSignedAdd    Script Date: 2007-6-20 21:28:27 ******/

    /***************************************************************************************    

        增加文件签收记录,返回新插入的记录ID或已有记录的ID
    ***************************************************************************************
    */

    CREATE  PROCEDURE {databaseOwner}{objectQualifier}[gdlmo_ArticleSignedAdd] 
        
    @UserId int,
        
    @ArticleId int,
        
    @SignedDate    DateTime
    AS
    DECLARE @Rcount INT
    SELECT @Rcount = COUNT(*FROM gdlmo_ArticleSigned WHERE (UserId=@UserId And ArticleId = @ArticleId)

    IF @Rcount>0 
    BEGIN
        
    SELECT ArticleSignedId FROM gdlmo_ArticleSigned WHERE UserId=@UserId And ArticleId = @ArticleId
    END
    ELSE
    BEGIN
        
    INSERT INTO gdlmo_ArticleSigned
        (
            
    [UserId],
            
    [ArticleId],
            
    [SignedDate]
        ) 
    VALUES    (
            
    @UserId,
            
    @ArticleId,
            
    @SignedDate    
        )

        
    SELECT SCOPE_IDENTITY()
    END


    GO

    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleSignedUsers    Script Date: 2007-6-20 21:28:27 ******/
    /***************************************************************************************    

        获取指定文件的未签收用户
    ***************************************************************************************
    */

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleSignedUsers 
        ( 
            
    @PortalId int,    
            
    @RoleId int,    
            
    @ArticleId int    
        ) 
    AS 
    /* 
    名称:GetPagingRecord 
    作用:获取指定文件的未签收用户 
    作者:莫光健(gdlmo)
    时间:2006-12-14 
    声明:此代码你可以无偿使用及转载,但在转载时,请勿移称本文字声明 
    */
     
    SELECT  U.UserID, 
            UP.PortalId, 
            U.Username, 
            U.FirstName, 
            U.LastName, 
            U.DisplayName, 
            U.IsSuperUser, 
            U.Email, 
            U.AffiliateId, 
            U.UpdatePassword 
    FROM UserPortals AS UP  INNER JOIN users AS U ON UP.UserId = U.UserID 
    WHERE ( UP.PortalId = @PortalId OR @PortalId IS Null ) AND
        (u.userid 
    in (SELECT userid FROM  gdlmo_ArticleSigned WHERE articleid=@ArticleId)) AND
        u.userid 
    in (SELECT userid FROM UserRoles WHERE Roleid=@RoleId)

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleUnSignedGetByUser    Script Date: 2007-6-20 21:28:27 ******/
    /*
        获取指定用户未签收的文件
    */

    CREATE PROCEDURE {databaseOwner}{objectQualifier}[gdlmo_ArticleUnSignedGetByUser]
        
    @UserId int
    AS
    SELECT  [ArticleID]
            
    [CategoryID]
            
    [Title]
            
    [CreatedDate]
            
    [CreatedByUser]
            
    [CopyFrom]
            
    [Author]
            
    [Hits]
            
    [IsPassed]
            
    [IP]
            
    [DeptName] 
    FROM gdlmo_Article
    WHERE ArticleId not in 
    (

    SELECT ArticleId FROM gdlmo_articlesigned WHERE userid =@UserId

    )

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleUnSignedUsers    Script Date: 2007-6-20 21:28:27 ******/
    /***************************************************************************************    

        获取指定文件的未签收用户
    ***************************************************************************************
    */

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleUnSignedUsers 
        ( 
            
    @PortalId int,    
            
    @RoleId int,    
            
    @ArticleId int    
        ) 
    AS 
    /* 
    名称:GetPagingRecord 
    作用:获取指定文件的未签收用户 
    作者:莫光健(gdlmo)
    时间:2006-12-14 
    声明:此代码你可以无偿使用及转载,但在转载时,请勿移称本文字声明 
    */
     
    SELECT  U.UserID, 
            UP.PortalId, 
            U.Username, 
            U.FirstName, 
            U.LastName, 
            U.DisplayName, 
            U.IsSuperUser, 
            U.Email, 
            U.AffiliateId, 
            U.UpdatePassword 
    FROM UserPortals AS UP  INNER JOIN users AS U ON UP.UserId = U.UserID 
    WHERE ( UP.PortalId = @PortalId OR @PortalId IS Null ) AND
        (u.userid 
    not in (SELECT userid FROM  gdlmo_ArticleSigned WHERE articleid=@ArticleId)) AND
        u.userid 
    in (SELECT userid FROM UserRoles WHERE Roleid=@RoleId)

    GO
    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleUpdate    Script Date: 2007-6-20 21:28:27 ******/

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleUpdate
        
    @ArticleID int
        
    @CategoryID int
        
    @Title nvarchar(255), 
        
    @CreatedDate smalldatetime
        
    @CreatedByUser nvarchar(100), 
        
    @CopyFrom nvarchar(255), 
        
    @Author nvarchar(255), 
        
    @Hits int
        
    @IsPassed bit
        
    @IP nvarchar(50), 
        
    @DeptName nvarchar(100) ,
        
    @Summary nvarchar(2000)
    AS

    UPDATE gdlmo_Article SET
        
    [CategoryID] = @CategoryID,
        
    [Title] = @Title,
        
    [CreatedDate] = @CreatedDate,
        
    [CreatedByUser] = @CreatedByUser,
        
    [CopyFrom] = @CopyFrom,
        
    [Author] = @Author,
        
    [Hits] = @Hits,
        
    [IsPassed] = @IsPassed,
        
    [IP] = @IP,
        
    [DeptName] = @DeptName,
        
    [Summary] = @Summary
    WHERE
        
    [ArticleID] = @ArticleID

    GO

    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleAdd    Script Date: 2007-6-20 21:28:27 ******/

    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleAdd
        
    @CategoryID int,
        
    @Title nvarchar(255),
        
    @CreatedDate smalldatetime,
        
    @CreatedByUser nvarchar(100),
        
    @CopyFrom nvarchar(255),
        
    @Author nvarchar(255),
        
    @Hits int,
        
    @IsPassed bit,
        
    @IP nvarchar(50),
        
    @DeptName nvarchar(100),
        
    @Summary nvarchar(2000),
        
    @ArticleNames nvarchar (2000)
    AS

    DECLARE @ArticleId int
    BEGIN
        
    INSERT INTO gdlmo_Article (
            
    [CategoryID],
            
    [Title],
            
    [CreatedDate],
            
    [CreatedByUser],
            
    [CopyFrom],
            
    [Author],
            
    [Hits],
            
    [IsPassed],
            
    [IP],
            
    [DeptName],
            
    [Summary]
        ) 
    VALUES (
            
    @CategoryID,
            
    @Title,
            
    @CreatedDate,
            
    @CreatedByUser,
            
    @CopyFrom,
            
    @Author,
            
    @Hits,
            
    @IsPassed,
            
    @IP,
            
    @DeptName,
            
    @Summary
        )

        
    SELECT @ArticleId = SCOPE_IDENTITY()
    END

    BEGIN
        
    DECLARE @strSql varchar(1000)

        
    SET @strsql = 'insert into gdlmo_article_accesory(articleid,articlename) '
        
    SET @strsql = @strsql + ' select ' + str(@ArticleId+ ',* from {databaseOwner}{objectQualifier}f_splitstr('''+ @ArticleNames + ''','';'')'   
        
    EXEC (@strsql
    END
    SELECT @ArticleId

    GO

    /****** Object:  Stored Procedure {databaseOwner}{objectQualifier}gdlmo_ArticleAndAccesoryUpdate    Script Date: 2007-6-20 21:28:27 ******/
    CREATE PROCEDURE {databaseOwner}{objectQualifier}gdlmo_ArticleAndAccesoryUpdate
        
    @ArticleId int
        
    @CategoryID int
        
    @Title nvarchar(255), 
        
    @CreatedDate smalldatetime
        
    @CreatedByUser nvarchar(100), 
        
    @CopyFrom nvarchar(255), 
        
    @Author nvarchar(255), 
        
    @Hits int
        
    @IsPassed bit
        
    @IP nvarchar(50), 
        
    @DeptName nvarchar(100) ,
        
    @Summary nvarchar(2000),
        
    @ArticleNames nvarchar (2000)
    AS

    UPDATE gdlmo_Article SET
        
    [CategoryID] = @CategoryID,
        
    [Title] = @Title,
        
    [CreatedDate] = @CreatedDate,
        
    [CreatedByUser] = @CreatedByUser,
        
    [CopyFrom] = @CopyFrom,
        
    [Author] = @Author,
        
    [Hits] = @Hits,
        
    [IsPassed] = @IsPassed,
        
    [IP] = @IP,
        
    [DeptName] = @DeptName,
        
    [Summary] = @Summary
    WHERE
        
    [ArticleID] = @ArticleId

    BEGIN

        
    DECLARE @strSql varchar(1000)
        
    SET @strsql = 'DELETE FROM gdlmo_article_accesory WHERE ArticleId = '+ cast(@ArticleId as varchar+ ' '
        
    SET @strsql = @strsql + 'insert into gdlmo_article_accesory(articleid,articlename) '
        
    SET @strsql = @strsql + 'select ' + cast(@ArticleId as varchar+ ',* from {databaseOwner}{objectQualifier}f_splitstr('''+ @ArticleNames + ''','';'')'
        
    EXEC (@strsql
        
    END

    GO


    开始 开始 Sql 操作 01.00.00.SqlDataProvider 文件
    失败 SQL 操作 异常: System.Data.SqlClient.SqlException: 第 54 行: ' select ' 附近有语法错误。 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL) in D:\web\DNN337\Providers\DataProviders\SqlDataProvider\SqlDataProvider.vb:line 148 at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) in D:\web\DNN337\Providers\DataProviders\SqlDataProvider\SqlDataProvider.vb:line 303 /****** Object: Stored Procedure dbo.gdlmo_ArticleAdd Script Date: 2007-6-20 21:28:27 ******/ CREATE PROCEDURE dbo.gdlmo_ArticleAdd @CategoryID int, @Title nvarchar(255), @CreatedDate smalldatetime, @CreatedByUser nvarchar(100), @CopyFrom nvarchar(255), @Author nvarchar(255), @Hits int, @IsPassed bit, @IP nvarchar(50), @DeptName nvarchar(100), @Summary nvarchar(2000), @ArticleNames nvarchar (2000) AS DECLARE @ArticleId int BEGIN INSERT INTO gdlmo_Article ( [CategoryID], [Title], [CreatedDate], [CreatedByUser], [CopyFrom], [Author], [Hits], [IsPassed], [IP], [DeptName], [Summary] ) VALUES ( @CategoryID, @Title, @CreatedDate, @CreatedByUser, @CopyFrom, @Author, @Hits, @IsPassed, @IP, @DeptName, @Summary ) SELECT @ArticleId = SCOPE_IDENTITY() END BEGIN DECLARE @strSql varchar(1000) SET @strsql = 'insert into gdlmo_article_accesory(articleid,articlename) ' SET @strsql = @strsql ' select ' str(@ArticleId) ',* from dbo.f_splitstr(''' @ArticleNames ''','';'')' EXEC (@strsql) END SELECT @ArticleId System.Data.SqlClient.SqlException: 第 37 行: 'cast' 附近有语法错误。第 38 行: 'insert into gdlmo_article_accesory(articleid,articlename) ' 附近有语法错误。第 39 行: 'select ' 附近有语法错误。 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL) in D:\web\DNN337\Providers\DataProviders\SqlDataProvider\SqlDataProvider.vb:line 148 at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) in D:\web\DNN337\Providers\DataProviders\SqlDataProvider\SqlDataProvider.vb:line 303 /****** Object: Stored Procedure dbo.gdlmo_ArticleAndAccesoryUpdate Script Date: 2007-6-20 21:28:27 ******/ CREATE PROCEDURE dbo.gdlmo_ArticleAndAccesoryUpdate @ArticleId int, @CategoryID int, @Title nvarchar(255), @CreatedDate smalldatetime, @CreatedByUser nvarchar(100), @CopyFrom nvarchar(255), @Author nvarchar(255), @Hits int, @IsPassed bit, @IP nvarchar(50), @DeptName nvarchar(100) , @Summary nvarchar(2000), @ArticleNames nvarchar (2000) AS UPDATE gdlmo_Article SET [CategoryID] = @CategoryID, [Title] = @Title, [CreatedDate] = @CreatedDate, [CreatedByUser] = @CreatedByUser, [CopyFrom] = @CopyFrom, [Author] = @Author, [Hits] = @Hits, [IsPassed] = @IsPassed, [IP] = @IP, [DeptName] = @DeptName, [Summary] = @Summary WHERE [ArticleID] = @ArticleId BEGIN DECLARE @strSql varchar(1000) SET @strsql = 'DELETE FROM gdlmo_article_accesory WHERE ArticleId = ' cast(@ArticleId as varchar) ' ' SET @strsql = @strsql 'insert into gdlmo_article_accesory(articleid,articlename) ' SET @strsql = @strsql 'select ' cast(@ArticleId as varchar) ',* from dbo.f_splitstr(''' @ArticleNames ''','';'')' EXEC (@strsql) END
    结束 结束 Sql 操作: 01.00.00.SqlDataProvider 文件
    有没有高手能给我指指错在那吗?
  • 相关阅读:
    Java基础学习总结(41)——JPA常用注解
    Java基础学习总结(41)——JPA常用注解
    【云速建站】视频播放专题
    一招教你如何修复MySQL slave中继日志损坏问题
    【nodejs原理&源码赏析(3)】欣赏手术级的原型链加工艺术
    【云速建站】后台数据批量导入导出
    【云速建站】会员注册弹窗添加及设置
    【nodejs原理&源码赏析(2)】KOA中间件的基本运作原理
    【nodejs原理&源码赏析(1)】Express中间件系统的基本实现
    补习系列(5)-springboot- restful应用
  • 原文地址:https://www.cnblogs.com/GDLMO/p/1009311.html
Copyright © 2020-2023  润新知