Hodnota< nullconstant> není deklarována.

Hodnota< nullconstant> není deklarována. Nulová konstanta již není podporována; místo toho použijte System.DBNull.

Příkaz používá Null klíčové slovo, které již není podporováno v jazyce Visual Basic.

ID chyby: BC30822

Oprava této chyby

  1. Používejte DBNull místo Null. Následující příklad ukazuje to.

    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. Při použití proměnných objektů použijte klíčové slovo Nothing pro přiřazení a porovnání. Následující příklad ukazuje to.

    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  
    

Viz také