Example #1
0
        private static Task CreateTableOption(CreateTableOption createTableOption)
        {
            var connectionString = createTableOption.SqlConnectionString;
            var table            = createTableOption.TableName;
            var sqlClient        = new SqlClient(connectionString);

            sqlClient.Open();
            try
            {
                sqlClient.CreateTableIfNotExist(table);
            }
            finally
            {
                sqlClient.Close();
            }
            return(Task.CompletedTask);
        }
Example #2
0
        private static Task CreateTableOption(CreateTableOption createTableOption)
        {
            var connectionString = createTableOption.SqlConnectionString;
            var table            = createTableOption.TableName;
            var sqlClient        = new SqlClient(connectionString);

            sqlClient.Open();
            try
            {
                if (createTableOption.TableType == 1)
                {
                    sqlClient.CreateTableIfNotExist(table, SqlClient.CommandsToCreateTable);
                }
                else if (createTableOption.TableType == 2)
                {
                    sqlClient.CreateTableIfNotExist(table, SqlClient.CommandsToCreateConnStatTable);
                }
            }
            finally
            {
                sqlClient.Close();
            }
            return(Task.CompletedTask);
        }