'<nullconstant>' は宣言されていません。

更新 : 2007 年 11 月

エラー メッセージ

'<nullconstant>' は宣言されていません。Null 定数はサポートされていません。代わりに System.DBNull を使用してください。

Null キーワードを使用しているステートメントがありますが、このキーワードは Visual Basic でサポートされていません。

Error 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)