How to use a SQL statement to control a block of C# statements
Posted on 2007-10-08
Using the following statement:
commandString = "IF NOT EXISTS(SELECT 1 FROM syscolumns WHERE name = 'SubCatID')"
Is there a way that I can use this partial statement to control C# statements that follow? (kind of an IF followed by a block of C# statements). I want to be able to alter a table to a new format if the table has not been altered before. It's not a simple job, because I have to backup the old table data, delete the old table, create a new table and then restore some of the data.