I have the following code I would l ike to use as a sanity check.
I am open to suggestions if there is a better way.
This code currently does not work because ExecuteNonQuery only works on insert,update and delete statements.
Can anyone point out what I should be using?
Dim CheckRecordStatus As String = "select * from table where RecordStatus is NULL"
'Instantiate the SQL Query
Dim CMDCheckRecord As SqlCommand = Nothing
CMDCheckRecord = New SqlCommand(CheckRecordStatus, _conn)
CMDCheckRecord.CommandTimeout = 30
CheckRecordCount = CMDCheckRecord.ExecuteNonQuery()
If CheckRecordCount > 0 Then Throw New Exception("A RecordStatus is Null. ")
Catch ex As Exception
Throw New Exception("STOP There is at least one empty RecordStatus. " & ex.Message)