Dealing with a null result from a SQL qry
Posted on 2005-05-13
I have the following code, but when I run it, and the query that its data is derived returns a row, and that row has a value of Null
If dr.HasRows Then
Attempt = dr.Item("attempt")
If Attempt = Nothing Then
txtAttemptNumber.Text = 1
txtAttemptNumber.Text = Attempt
I get the following error:
Cast from type 'DBNull' to type 'Integer' is not valid.
Can anybody see how to fix this, please?