How to handle null value in sql statement?

  • Thread starter Thread starter Butt Chin Chuan
  • Start date Start date
B

Butt Chin Chuan

I use a select statement to try to get the max ID for my
table, "Select max (ID) as CurrentMaxID from Table1", and
since the table is blank (newly created), I will get a
return row with Null value. I couldn't execute the
following statement, "objSqlDataAdapter.Fill
(objDataset, "Table1")". In eVB, I can use this statement
to check the Null value, "If IsNull(rs.Fields
("CurrentMaxID").Value) Then ... End If ". Can anyone
please inform me the equalvalent of the above statement to
check the Null value in VB.net? Thank you.
 
Sounds like you might want to use this function

Microsoft.VisualBasic.Information.IsDbNull(ByVal Expression as Object) as
boolean

I use it in my app to test fields in a DataRow to see if they're Null.

// Dave



I use a select statement to try to get the max ID for my
table, "Select max (ID) as CurrentMaxID from Table1", and
since the table is blank (newly created), I will get a
return row with Null value. I couldn't execute the
following statement, "objSqlDataAdapter.Fill
(objDataset, "Table1")". In eVB, I can use this statement
to check the Null value, "If IsNull(rs.Fields
("CurrentMaxID").Value) Then ... End If ". Can anyone
please inform me the equalvalent of the above statement to
check the Null value in VB.net? Thank you.
 
Back
Top