c# - Is there a way how to check if the operation is valid before is called? -
Is there any way to know how this statement is valid before saying the statement? For example, when you are trying to delete the column which is not present or when you are trying to delete the record that is connected to the foreign key and you remove it To refuse. Click on some such parse (Ctrl + F5) button, but it is said by the code (ideally it is possible to call by calling the C # code.) Something like this < / P> The shortcut does not help much. I really would like to be able to call the database and make sure that it will not give me an error. I think, perhaps, then thinking about this wrong. A If you get the
Exec sp_canIdoIt ("SQL statement").
SqlException can be controlled from a
try-catch block, why to test the validity of some to execute strange psuedo logic Instead of not just handle the error case? You can do your work which gives success status based on your error.
connection.Open () on
SqlException , then your database inaccessible if you have a question
SqlException If found, there is a problem with the query. Just handle that case, return any kind of error enhancement, and do something else with it.
Comments
Post a Comment