To check if the executed query was successful, in PHP all you have to do is
$Result = mssql_query('SELECT * FROM myTable');
& check if ‘Result’ is false.
My Question is does .NET have any such simple functionality to check if the executed query
was successful?
I don’t want check the result was null, because if it’s an insert statement then also the result will be null.
from the manual
mssql_query
Returns a MS SQL result resource on success, TRUE if no rows were returned, or FALSE on error.
In addition to what other people said (and assuming you are using ADO.NET), for non-SELECT queries you can check the result of the
DbCommand.ExecuteNonQuery. This gives you the number of rows affected by an INSERT, UPDATE or DELETE statement.This way you can, for example, check whether the WHERE clause in your UPDATE or DELETE “identified” the correct number of rows.