다음을 통해 공유


'<nullconstant>'이(가) 선언되지 않았습니다.

업데이트: 2007년 11월

오류 메시지

'<nullconstant>'이(가) 선언되지 않았습니다. Null 상수가 더 이상 지원되지 않으므로 System.DBNull을 대신 사용하십시오.
'<nullconstant>' is not declared. Null constant is no longer supported; use System.DBNull instead.

문에서 Null 키워드를 사용하지만 이 키워드는 Visual Basic에서 더 이상 지원되지 않습니다.

오류 ID: BC30822

이 오류를 해결하려면

  1. Null 대신 DBNull을 사용합니다. 다음은 이에 대한 예입니다.

    Sub TestDBNull()
        Dim t As DataTable
        ' Assume the DataGrid is bound to a DataTable.
        t = CType(DataGrid1.DataSource, DataTable)
        Dim r As DataRow
        r = t.Rows(datagrid1.CurrentCell.RowNumber)
        r.BeginEdit
        r(1) = System.DBNull.Value ' Assign DBNull to the record.
        r.EndEdit
        r.AcceptChanges
        If r.IsNull(1) Then
            MsgBox("")
        End If
    End Sub
    
  2. 개체 변수를 사용할 때 대입 및 비교에 Nothing(Visual Basic) 키워드를 사용합니다. 다음은 이에 대한 예입니다.

    Sub TestNothing()
        Dim cls As Object
        ' cls is Nothing if it has not been assigned using the New keyword.
        If (cls Is Nothing) Then
            MsgBox("cls is Nothing")
        End If
        cls = Nothing ' Assign Nothing to the class variable cls.
    End Sub
    

참고 항목

개념

프로그래밍 요소 지원 변경 사항 요약

참조

DBNull

Nothing(Visual Basic)