解决方案 »

  1.   

    不是,ctrl+f 搜索只有那两个视图的代码
      

  2.   

    是这些吗/****** Object:  View [gengjunzf3].[vwNews]    Script Date: 03/25/2014 13:51:17 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [gengjunzf3].[vwNews]
    AS
    SELECT gengjunzf3.NewsInfo.NewsInfoID, gengjunzf3.NewsInfo.NewsInfoTitle, 
          gengjunzf3.NewsInfo.NewsInfoContent, gengjunzf3.NewsInfo.ClickSum, 
          gengjunzf3.NewsInfo.MakeDate, gengjunzf3.NewsInfo.TitlePhoto, 
          gengjunzf3.NewsInfo.FileUrl, gengjunzf3.NewsInfo.NewsTypeID, 
          gengjunzf3.NewsType.NewsTypeName, gengjunzf3.NewsItem.NewsItemName, 
          gengjunzf3.NewsItem.NewsItemID
    FROM gengjunzf3.NewsInfo INNER JOIN
          gengjunzf3.NewsType ON 
          gengjunzf3.NewsInfo.NewsTypeID = gengjunzf3.NewsType.NewsTypeID INNER JOIN
          gengjunzf3.NewsItem ON 
          gengjunzf3.NewsType.NewsItemID = gengjunzf3.NewsItem.NewsItemID
    GO
    EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
    Begin DesignProperties = 
       Begin PaneConfigurations = 
          Begin PaneConfiguration = 0
             NumPanes = 4
             Configuration = "(H (1[40] 4[20] 2[20] 3) )"
          End
          Begin PaneConfiguration = 1
             NumPanes = 3
             Configuration = "(H (1 [50] 4 [25] 3))"
          End
          Begin PaneConfiguration = 2
             NumPanes = 3
             Configuration = "(H (1[50] 2[25] 3) )"
          End
          Begin PaneConfiguration = 3
             NumPanes = 3
             Configuration = "(H (4 [30] 2 [40] 3))"
          End
          Begin PaneConfiguration = 4
             NumPanes = 2
             Configuration = "(H (1 [56] 3))"
          End
          Begin PaneConfiguration = 5
             NumPanes = 2
             Configuration = "(H (2 [66] 3))"
          End
          Begin PaneConfiguration = 6
             NumPanes = 2
             Configuration = "(H (4 [50] 3))"
          End
          Begin PaneConfiguration = 7
             NumPanes = 1
             Configuration = "(V (3))"
          End
          Begin PaneConfiguration = 8
             NumPanes = 3
             Configuration = "(H (1 [56] 4 [18] 2))"
          End
          Begin PaneConfiguration = 9
             NumPanes = 2
             Configuration = "(H (1 [75] 4))"
          End
          Begin PaneConfiguration = 10
             NumPanes = 2
             Configuration = "(H (1[66] 2) )"
          End
          Begin PaneConfiguration = 11
             NumPanes = 2
             Configuration = "(H (4 [60] 2))"
          End
          Begin PaneConfiguration = 12
             NumPanes = 1
             Configuration = "(H (1) )"
          End
          Begin PaneConfiguration = 13
             NumPanes = 1
             Configuration = "(V (4))"
          End
          Begin PaneConfiguration = 14
             NumPanes = 1
             Configuration = "(V (2))"
          End
          ActivePaneConfig = 0
       End
       Begin DiagramPane = 
          Begin Origin = 
             Top = 0
             Left = 0
          End
          Begin Tables = 
             Begin Table = "NewsInfo"
                Begin Extent = 
                   Top = 6
                   Left = 38
                   Bottom = 116
                   Right = 209
                End
                DisplayFlags = 280
                TopColumn = 0
             End
             Begin Table = "NewsType"
                Begin Extent = 
                   Top = 6
                   Left = 247
                   Bottom = 102
                   Right = 400
                End
                DisplayFlags = 280
                TopColumn = 0
             End
             Begin Table = "NewsItem"
                Begin Extent = 
                   Top = 6
                   Left = 438
                   Bottom = 88
                   Right = 591
                End
                DisplayFlags = 280
                TopColumn = 0
             End
          End
       End
       Begin SQLPane = 
       End
       Begin DataPane = 
          Begin ParameterDefaults = ""
          End
          RowHeights = 240
       End
       Begin CriteriaPane = 
          Begin ColumnWidths = 11
             Column = 1440
             Alias = 900
             Table = 1170
             Output = 720
             Append = 1400
             NewValue = 1170
             SortType = 1350
             SortOrder = 1410
             GroupBy = 1350
             Filter = 1350
             Or = 1350
             Or = 1350
             Or = 1350
          End
       End
    End
    ' , @level0type=N'SCHEMA',@level0name=N'gengjunzf3', @level1type=N'VIEW',@level1name=N'vwNews'
    GO
    EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'gengjunzf3', @level1type=N'VIEW',@level1name=N'vwNews'
    GO
    /****** Object:  View [gengjunzf3].[vwJiedao]    Script Date: 03/25/2014 13:51:16 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [gengjunzf3].[vwJiedao]
    AS
    SELECT gengjunzf3.JieDaoUser.JieDaoUserID, gengjunzf3.JieDaoUser.LoginName, 
          gengjunzf3.JieDaoUser.ReadName, gengjunzf3.JieDaoUser.LoginPassword, 
          gengjunzf3.JieDaoUser.Sex, gengjunzf3.JieDaoUser.JiedaoID, 
          gengjunzf3.JieDaoUser.Address, gengjunzf3.JieDaoUser.Tel, 
          gengjunzf3.JieDaoUser.Email, gengjunzf3.JieDaoUser.State, 
          gengjunzf3.JieDaoUser.SendDate, gengjunzf3.Jiedao.jiedao
    FROM gengjunzf3.JieDaoUser INNER JOIN
          gengjunzf3.Jiedao ON gengjunzf3.JieDaoUser.JiedaoID = gengjunzf3.Jiedao.jiedaoID
    GO
    EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
    Begin DesignProperties = 
       Begin PaneConfigurations = 
          Begin PaneConfiguration = 0
             NumPanes = 4
             Configuration = "(H (1[40] 4[20] 2[20] 3) )"
          End
          Begin PaneConfiguration = 1
             NumPanes = 3
             Configuration = "(H (1 [50] 4 [25] 3))"
          End
          Begin PaneConfiguration = 2
             NumPanes = 3
             Configuration = "(H (1[50] 2[25] 3) )"
          End
          Begin PaneConfiguration = 3
             NumPanes = 3
             Configuration = "(H (4 [30] 2 [40] 3))"
          End
          Begin PaneConfiguration = 4
             NumPanes = 2
             Configuration = "(H (1 [56] 3))"
          End
          Begin PaneConfiguration = 5
             NumPanes = 2
             Configuration = "(H (2 [66] 3))"
          End
          Begin PaneConfiguration = 6
             NumPanes = 2
             Configuration = "(H (4 [50] 3))"
          End
          Begin PaneConfiguration = 7
             NumPanes = 1
             Configuration = "(V (3))"
          End
          Begin PaneConfiguration = 8
             NumPanes = 3
             Configuration = "(H (1 [56] 4 [18] 2))"
          End
          Begin PaneConfiguration = 9
             NumPanes = 2
             Configuration = "(H (1 [75] 4))"
          End
          Begin PaneConfiguration = 10
             NumPanes = 2
             Configuration = "(H (1[66] 2) )"
          End
          Begin PaneConfiguration = 11
             NumPanes = 2
             Configuration = "(H (4 [60] 2))"
          End
          Begin PaneConfiguration = 12
             NumPanes = 1
             Configuration = "(H (1) )"
          End
          Begin PaneConfiguration = 13
             NumPanes = 1
             Configuration = "(V (4))"
          End
          Begin PaneConfiguration = 14
             NumPanes = 1
             Configuration = "(V (2))"
          End
          ActivePaneConfig = 0
       End
       Begin DiagramPane = 
          Begin Origin = 
             Top = 0
             Left = 0
          End
          Begin Tables = 
             Begin Table = "JieDaoUser"
                Begin Extent = 
                   Top = 6
                   Left = 38
                   Bottom = 116
                   Right = 197
                End
                DisplayFlags = 280
                TopColumn = 0
             End
             Begin Table = "Jiedao"
                Begin Extent = 
                   Top = 6
                   Left = 235
                   Bottom = 88
                   Right = 370
                End
                DisplayFlags = 280
                TopColumn = 0
             End
          End
       End
       Begin SQLPane = 
       End
       Begin DataPane = 
          Begin ParameterDefaults = ""
          End
          RowHeights = 240
       End
       Begin CriteriaPane = 
          Begin ColumnWidths = 11
             Column = 1440
             Alias = 900
             Table = 1170
             Output = 720
             Append = 1400
             NewValue = 1170
             SortType = 1350
             SortOrder = 1410
             GroupBy = 1350
             Filter = 1350
             Or = 1350
             Or = 1350
             Or = 1350
          End
       End
    End
    ' , @level0type=N'SCHEMA',@level0name=N'gengjunzf3', @level1type=N'VIEW',@level1name=N'vwJiedao'
    GO
    EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'gengjunzf3', @level1type=N'VIEW',@level1name=N'vwJiedao'
    GO
      

  3.   

    是的,问题比较清晰了,你的视图引用了很多表,而你的表是否预先已经创建到目标数据库?如果没有,那么执行创建视图过程就会报错,然后创建不成功,Msg 208, Level 16, State 1, Procedure vwNews, Line 9
    Invalid object name 'gengjunzf3.NewsInfo'.
    Msg 15135, Level 16, State 4, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwNews', or the object does not exist.
    Msg 15135, Level 16, State 4, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwNews', or the object does not exist.
    Msg 208, Level 16, State 1, Procedure vwJiedao, Line 9
    Invalid object name 'gengjunzf3.JieDaoUser'.
    Msg 15135, Level 16, State 4, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwJiedao', or the object does not exist.
    Msg 15135, Level 16, State 4, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwJiedao', or the object does not exist.
    先把这些里面提到的表预先创建再试试
      

  4.   

    应该是这2个视图所引用的表,不存在吧,看来不仅是少了视图,连表也少了,查询有多少个表:
    select *
    from sys.tables查询有多少视图:
    select *
    from sys.views
      

  5.   

    USE gengjunzf3
    GO
    sp_help 'vwNews'
    执行一下,另外确保你没有连错实例。
      

  6.   

    SELECT * FROM sys.views WHERE name LIKE '%vwnews%'
    这个呢?
      

  7.   

    哥,点【Execute】,不是点勾,也就是叫你点红色叹号.....
      

  8.   

    这是 我单独执行创建视图的语句结果  但我看不懂
    Msg 2714, Level 16, State 3, Procedure vwNews, Line 3
    There is already an object named 'vwNews' in the database.
    Msg 15135, Level 16, State 9, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwNews', or the object does not exist.
    Msg 15135, Level 16, State 9, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwNews', or the object does not exist.
    Msg 2714, Level 16, State 3, Procedure vwJiedao, Line 3
    There is already an object named 'vwJiedao' in the database.
    Msg 15135, Level 16, State 9, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwJiedao', or the object does not exist.
    Msg 15135, Level 16, State 9, Procedure sp_addextendedproperty, Line 37
    Object is invalid. Extended properties are not permitted on 'gengjunzf3.vwJiedao', or the object does not exist.
      

  9.   

    访问的时候需要比如用这种方式:
    select * from gengjunzf3.vwNews
      

  10.   


    什么意思   我这个项目是从别的地方完整的拷贝过来的,现在数据库导入也有报错,拷贝过来的其他项目也是用的这个数据库,就没问题,至于这个项目访问呢出这个粗我u,是在理解不能。.net我是一点也不懂
      

  11.   

    问题解决了,我在数据库成功导入后,新建了一个和源数据库一样的账号,修改数据库配置文件后就成功了。项目拷贝过来后一直用的windows身份验证方式登录。