class Program
{
static void Main(string[] args)
{
DataTable dt = new DataTable();
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OracleClient");
using (IDbConnection conn = factory.CreateConnection())
{
conn.ConnectionString = "Persist Security Info=True;User ID=deinUser;Password=deinPasswort;" +
"Data source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=
TCP)" +
"(HOST=
localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DeineDB)))";
conn.Open();
using (IDbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "select * from all_users";
using (IDataReader rdr = cmd.ExecuteReader())
dt.Load(rdr);
}
}
System.Windows.Forms.Application.EnableVisualStyles();
using (System.Windows.Forms.Form frm = new System.Windows.Forms.Form())
{
DoubleBufferedDataGridView dgv = new DoubleBufferedDataGridView();
dgv.Dock = System.Windows.Forms.DockStyle.Fill;
dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
dgv.AutoGenerateColumns = true;
dgv.DataSource = dt;
frm.Controls.Add(dgv);
frm.ShowDialog();
}
}
}
class DoubleBufferedDataGridView : System.Windows.Forms.DataGridView
{
protected override void CreateHandle()
{
DoubleBuffered = true;
base.CreateHandle();
}
}