Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looking for blank fields

Status
Not open for further replies.

smithbr

MIS
May 29, 2003
85
US
I have a datagrid i am trying to update and need to know a way I can get it to only update those fields that have nothing in tehm...I have it written now as
dr.Item("Paid") = ""
but this is not working....how else can I write this so it works?
 
This might shed some light. In my table, the column with the index of 2 is the column in which I can have null values. I'm testing against that. Use the IsDBNull function.

Code:
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
        Dim r As DataRow
        r = DataSet11.Tables(0).Rows(DataGrid1.CurrentCell.RowNumber)
        If IsDBNull(r(2)) Then
            MsgBox(r(1) & " is Null")
        Else
            MsgBox(r(1) & " is not Null")
        End If
    End Sub
 
I believe there is no more IsNull function, must use IsDBNull.
 

Well there is DataRow.IsNull method which gets a value indicating whether the specified column contains a null value.

see MSDN for more details....





 
Cool, I was referreing to the generic IsNull function available in VB 6. But the DataRow's IsNull method will work too.
 
Thank you guys....I figured it out
I used the system.dbnull
the new code looks like this
dr.Item("Paid") IS System.dbnull

Thanks again for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top