I've got the script below which I execute against my sql database and get an error stating "incorrect syntax near =" and the following line is highlighted:
If IsDBNull(command.ExecuteScalar) Then
email = "None"
Code:
Dim conn As New SqlConnection(sqlconn)
Dim command As New SqlCommand(ssql, conn)
conn.Open()
If IsDBNull(command.ExecuteScalar) Then
email = "None"
Else
email = command.ExecuteScalar
End If
conn.Close()
conn.Dispose()
Code for function:
Public Function IsDBNull(ByVal dbvalue) As Boolean
Return dbvalue Is DBNull.Value
End Function
I know that the results are an empty record set but I thought the isdbnull function would catch it. Where am I off?
If IsDBNull(command.ExecuteScalar) Then
email = "None"
Code:
Dim conn As New SqlConnection(sqlconn)
Dim command As New SqlCommand(ssql, conn)
conn.Open()
If IsDBNull(command.ExecuteScalar) Then
email = "None"
Else
email = command.ExecuteScalar
End If
conn.Close()
conn.Dispose()
Code for function:
Public Function IsDBNull(ByVal dbvalue) As Boolean
Return dbvalue Is DBNull.Value
End Function
I know that the results are an empty record set but I thought the isdbnull function would catch it. Where am I off?