Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub NavigateRecords()

        txttransactionnumber.Text = ds.Tables("tblaccounts").Rows(inc).Item(0)
        txtdate.Text = ds.Tables("tblaccounts").Rows(inc).Item(1)
        txtamount.Text = ds.Tables("tblaccounts").Rows(inc).Item(2)
        txtaccounttitle.Text = ds.Tables("tblaccounts").Rows(inc).Item(3)
        txtnormalbalance.Text = ds.Tables("tblaccounts").Rows(inc).Item(4)
        txtdescription.Text = ds.Tables("tblaccounts").Rows(inc).Item(5)
        txtfinancialstatement.Text = ds.Tables("tblaccounts").Rows(inc).Item(6)
        txtcompanyname.Text = ds.Tables("tblaccounts").Rows(inc).Item(7)
        txtcareof.Text = ds.Tables("tblaccounts").Rows(inc).Item(8)
        txtduedate.Text = ds.Tables("tblaccounts").Rows(inc).Item(9)

    End Sub
Posted
Comments
Member 11475835 6-Mar-15 12:01pm    
txttransactionnumber.Text = ds.Tables("tblaccounts").Rows(inc).Item(0)
this is the line where the warning pops up
PIEBALDconsult 6-Mar-15 12:09pm    
The simplest thing to do in this case is to add .ToString() to each Item .
Member 11475835 6-Mar-15 12:15pm    
thank you... it is now working

The database is missing a value, and thus, you will get a DBNull[^] back.

Check for nulls.
If Not DbNull.Value.Equals(ds.Tables("tblaccounts").Rows(inc).Item(0)) Then
    Return ds.Tables("tblaccounts").Rows(inc).Item(0)
 Else
    Return Nothing
 End If
 
Share this answer
 
Comments
Member 11475835 6-Mar-15 12:15pm    
thank you
 
Share this answer
 
Comments
Member 11475835 6-Mar-15 12:15pm    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900