Hi, I have a sqlCommand object that I use to execute an SQL statement.
I thought I could use the ExecuteNonQuery to test for the number of rows
returned by the sql command but it does not seem to work
My code is below..
Dim sSQL As String = "SELECT Blah FROM Table WHERE BlahID = 5"
Dim oCOmmand As New SqlClient.SqlCommand(sSQL, openDatabase)
If oCOmmand.ExecuteNonQuery > 0 Then
' At least one row matches SQL statement
Else
' no rows match the sql statement
End If
Help appreciated as I thought the number ExecuteNonQuery returned the number
of rows affected by the SQL statement.
If I run the SQL command in query analyser I get at least one row returned.
Cheers
Mark