I need my program to connect to a database, check if a table exists, and if not, create it.
I intend to check the presence of a table by simply running a "select * from table" query via an SqlCommand. I am going to put this in a try block. My problem is, how/where do I actually create the table? In the catch block? What if the SqlException was not due to the table not existing, but for instance due to an incorrect password? What is the best way to do this?
Thanks!