为什么Command.ExecuteNonQuery给我一个编译错误

时间:2015-09-14 16:41:34

标签: asp.net vb.net visual-studio-2012 webforms

我收到以下错误:

  

ASPNET:确保此代码文件中定义的类与   '继承'属性,并且它扩展了正确的基类(例如   Page或UserControl)。

我的aspx.vb文件中的代码是这样的。有人可以告诉我文件中缺少什么吗?

Imports System.Data.SqlClient

Partial Public Class NewMeetings
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal a As EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        Using con As New SqlConnection("Data Source=c3digpssql2;Integrated Security=true;Initial Catalog=ServiceLine_Committee")
            con.Open()
            Dim cmd As New SqlCommand("insert into ServiceLine_Committee.DBO.tblVotings(Meeting_ID, Committee_ID, Member_Name) , " +
                                       "SELECT C.ID, M.ID, CM.FULL_NAME FROM ServiceLine_Committee.DBO.tblCommitteeName C, " +
                                       "ServiceLine_Committee.DBO.tblMeetings M, ServiceLine_Committee.DBO.tblCommitteeMembers CM, " +
                                       "WHERE (M.ContractCategory   = C.Contract_Category, " +
                                       "AND M.Committee         = C.Committee_Name, " +
                                       "AND CM.Committee            = M.Committee)", con)

            Dim result As Integer = cmd.ExecuteNonQuery()

            con.Close()
        End Using
    End Sub

End Class

0 个答案:

没有答案