Chronozoom.Entities.ManualMigrationCheck.CETableExists C# (CSharp) Метод

CETableExists() приватный Метод

Function to check if a table exists in a CE database.
private CETableExists ( string tableName, SqlCeConnection sqlConnection ) : bool
tableName string The name of the table to check if exists
sqlConnection SqlCeConnection The SQLCeConnection to run the script against, which should already be established.
Результат bool
        private bool CETableExists(string tableName, SqlCeConnection sqlConnection)
        {
            bool rv = false;

            using (SqlCeCommand cmd = new SqlCeCommand("SELECT COUNT(1) FROM information_schema.tables WITH (NOLOCK) WHERE table_name = '" + tableName + "'", sqlConnection))
            {
                rv = (int) cmd.ExecuteScalar() == 1;
            }

            return rv;
        }