Exemplo n.º 1
0
        private void btnGetDatabase_Click(object sender, EventArgs e)
        {
            Director director = new Director();
            IDatabaseBuilder builder;

            if (radUseSqlServer.Checked)
            {
                builder = new SqlServerDatabaseBuilder();
            }
            else
            {
                builder = new OleDbDatabaseBuilder();
            }

            director.Build(builder);
            Database database = builder.Database;

            DbCommand command = database.Command;
            // now, we can do something, like:
            //command.CommandText = "SELECT * FROM Customers";
            //command.Connection.Open();
            //DbDataReader reader = command.ExecuteReader();

            //reader.Close();
            //command.Connection.Close();

        }
Exemplo n.º 2
0
        private void btnGetDatabase_Click(object sender, EventArgs e)
        {
            Director         director = new Director();
            IDatabaseBuilder builder;

            if (radUseSqlServer.Checked)
            {
                builder = new SqlServerDatabaseBuilder();
            }
            else
            {
                builder = new OleDbDatabaseBuilder();
            }

            director.Build(builder);
            Database database = builder.Database;

            DbCommand command = database.Command;
            // now, we can do something, like:
            //command.CommandText = "SELECT * FROM Customers";
            //command.Connection.Open();
            //DbDataReader reader = command.ExecuteReader();

            //reader.Close();
            //command.Connection.Close();
        }