none
启动调试后生成的错误如何解决的问题(4) RRS feed

  • 问题

  • 在启动调试后出现了下面的问题。错误提示是:未声明名称“ISDBNULL”。不知道怎么解决。已知db.vb是连接字符串的类文件。

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


            Dim strsql, course As String
            Dim conn As New constr.db
            Dim i, courseid As Integer
            strsql = "select max(id) as maxno from klgpointab"
            Dim dr As SqlDataReader
            Dim myconn As New SqlConnection(conn.getstr)
            Dim mycommand1 As New SqlCommand(strsql, myconn)
            myconn.Open()
            dr = mycommand1.ExecuteReader()
            dr.Read()
            If IsDBNull(dr.Item(0)) Then
                i = 0
            Else
                i = dr.Item(0) + 1
            End If
            dr.Close()
            Dim dr1 As SqlDataReader
            course = Session("coursename")
            strsql = "select courseid from courseinfo where coursename='" & course & "'"
            Dim mycommand2 As New SqlCommand(strsql, myconn)
            dr1 = mycommand2.ExecuteReader
            If dr1.Read() Then
                courseid = dr1.Item(0)
            End If
            dr1.Close()
            strsql = "insert into klgpointab(id,chapter,knowledgepoint,coursename) values("
            strsql = strsql & i & ","
            strsql = strsql & courseid * 100 + j & ",'"
            strsql = strsql & TextBox1.Text & "',"
            strsql = strsql & "'" & course.ToString().Trim() & "')"
            Dim mycommand3 As New SqlCommand(strsql, myconn)
            mycommand3.ExecuteNonQuery()
            j = j + 1
            TextBox1.Text = ""
            myconn.Close()
            mycommand1.Dispose()
            mycommand2.Dispose()
            mycommand3.Dispose()
            myconn.Dispose()
        End Sub


    qianghuishi

    2012年3月17日 2:29

答案

全部回复