To compare for a null value in the database, use
is System.DBNull
.
vbNullString
corresponds to
string.Empty
.
I'd prefer
if(ds.Tables[0].Rows[0]["Ledger"] is System.DBNull)
{
str=string.Empty;
}
else
{
str=ds.Tables[0].Rows[0]["Ledger"].ToString();
}