I want to scan a database and then create a table using DataReader if it does not already exist. I found a block of code that is used to create a table, but it is in VB, which is not ideal as the rest of my code is C#. Regardless, I can't get it to work either way.
This is my code, thanks for taking a look:
var dif = new DataInterfaceFactory(DatabaseTypes.SqlServer, " DATABASE_NAME", "[SERVER_NAME]");
            using (DataReader dr = dif.GetDataReader())
            {
                exists = m_api.Database.ExecuteCommand(@"IF EXISTS(SELECT COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'TABLE_NAME')");
                while (dr.Read())
                {
                    if (exists == 0)
                    {
                        TableBuilder calculationSchedule = new TableBuilder("TABLE_NAME", dif.DatabaseType);
                        calculationSchedule.AddField("TABLE_NAME_UID", DbFieldType.int_, 0, false, null, true, null);
                        calculationSchedule.AddField("SERVER_NAME", DbFieldType.nvarchar_);
                        calculationSchedule.AddField("DATABASE_NAME", DbFieldType.nvarchar_);
                        calculationSchedule.AddField("CHECK_DATE", DbFieldType.datetime_);
                        calculationSchedule.AddField("IS_RUNNING", DbFieldType.int_);
                        using (CommandExecutor cex = dif.GetCommandExecutor())
                        {
                            calculationSchedule.BuildTable(cex);
                        }
                    }
               }
           }
 
     
    