<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FADO.Net%2FOleDbDataReader</id>
		<title>Csharp/CSharp Tutorial/ADO.Net/OleDbDataReader - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FADO.Net%2FOleDbDataReader"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/ADO.Net/OleDbDataReader&amp;action=history"/>
		<updated>2026-04-30T02:31:42Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/ADO.Net/OleDbDataReader&amp;diff=6486&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/ADO.Net/OleDbDataReader&amp;diff=6486&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/ADO.Net/OleDbDataReader&amp;diff=6487&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/ADO.Net/OleDbDataReader&amp;diff=6487&amp;oldid=prev"/>
				<updated>2010-05-26T12:19:12Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Get SchemaTable from OleDbDataReader==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.OleDb;&lt;br /&gt;
  public class Form1 : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
        private System.Windows.Forms.Label label1;&lt;br /&gt;
        private System.Windows.Forms.Button button1;&lt;br /&gt;
        private System.Windows.Forms.TextBox textBox1;&lt;br /&gt;
        private System.Windows.Forms.TextBox textBox2;&lt;br /&gt;
        private System.Windows.Forms.TextBox textBox3;&lt;br /&gt;
        private System.Windows.Forms.TextBox textBox4;&lt;br /&gt;
    public Form1()&lt;br /&gt;
    {&lt;br /&gt;
            this.label1 = new System.Windows.Forms.Label();&lt;br /&gt;
            this.button1 = new System.Windows.Forms.Button();&lt;br /&gt;
            this.textBox1 = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.textBox2 = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.textBox3 = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.textBox4 = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.SuspendLayout();&lt;br /&gt;
            // &lt;br /&gt;
            // label1&lt;br /&gt;
            // &lt;br /&gt;
            this.label1.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));&lt;br /&gt;
            this.label1.Location = new System.Drawing.Point(0, 0);&lt;br /&gt;
            this.label1.Name = &amp;quot;label1&amp;quot;;&lt;br /&gt;
            this.label1.Size = new System.Drawing.Size(232, 48);&lt;br /&gt;
            this.label1.TabIndex = 0;&lt;br /&gt;
            this.label1.Text = &amp;quot;Data Readers&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // button1&lt;br /&gt;
            // &lt;br /&gt;
            this.button1.Location = new System.Drawing.Point(128, 232);&lt;br /&gt;
            this.button1.Name = &amp;quot;button1&amp;quot;;&lt;br /&gt;
            this.button1.TabIndex = 1;&lt;br /&gt;
            this.button1.Text = &amp;quot;Read data&amp;quot;;&lt;br /&gt;
            this.button1.Click += new System.EventHandler(this.button1_Click);&lt;br /&gt;
            // &lt;br /&gt;
            // textBox1&lt;br /&gt;
            // &lt;br /&gt;
            this.textBox1.Location = new System.Drawing.Point(8, 56);&lt;br /&gt;
            this.textBox1.Multiline = true;&lt;br /&gt;
            this.textBox1.Name = &amp;quot;textBox1&amp;quot;;&lt;br /&gt;
            this.textBox1.Size = new System.Drawing.Size(72, 152);&lt;br /&gt;
            this.textBox1.TabIndex = 2;&lt;br /&gt;
            this.textBox1.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // textBox2&lt;br /&gt;
            // &lt;br /&gt;
            this.textBox2.Location = new System.Drawing.Point(88, 56);&lt;br /&gt;
            this.textBox2.Multiline = true;&lt;br /&gt;
            this.textBox2.Name = &amp;quot;textBox2&amp;quot;;&lt;br /&gt;
            this.textBox2.Size = new System.Drawing.Size(72, 152);&lt;br /&gt;
            this.textBox2.TabIndex = 3;&lt;br /&gt;
            this.textBox2.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // textBox3&lt;br /&gt;
            // &lt;br /&gt;
            this.textBox3.Location = new System.Drawing.Point(168, 56);&lt;br /&gt;
            this.textBox3.Multiline = true;&lt;br /&gt;
            this.textBox3.Name = &amp;quot;textBox3&amp;quot;;&lt;br /&gt;
            this.textBox3.Size = new System.Drawing.Size(72, 152);&lt;br /&gt;
            this.textBox3.TabIndex = 4;&lt;br /&gt;
            this.textBox3.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // textBox4&lt;br /&gt;
            // &lt;br /&gt;
            this.textBox4.Location = new System.Drawing.Point(248, 56);&lt;br /&gt;
            this.textBox4.Multiline = true;&lt;br /&gt;
            this.textBox4.Name = &amp;quot;textBox4&amp;quot;;&lt;br /&gt;
            this.textBox4.Size = new System.Drawing.Size(72, 152);&lt;br /&gt;
            this.textBox4.TabIndex = 5;&lt;br /&gt;
            this.textBox4.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // Form1&lt;br /&gt;
            // &lt;br /&gt;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
            this.ClientSize = new System.Drawing.Size(328, 273);&lt;br /&gt;
            this.Controls.Add(this.textBox4);&lt;br /&gt;
            this.Controls.Add(this.textBox3);&lt;br /&gt;
            this.Controls.Add(this.textBox2);&lt;br /&gt;
            this.Controls.Add(this.textBox1);&lt;br /&gt;
            this.Controls.Add(this.button1);&lt;br /&gt;
            this.Controls.Add(this.label1);&lt;br /&gt;
            this.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
            this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
            this.ResumeLayout(false);&lt;br /&gt;
        }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
        private void button1_Click(object sender, System.EventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            string connection1String = &amp;quot;Provider=SQLOLEDB;Data Source=;User ID=sa;Initial Catalog=pubs;&amp;quot;; &lt;br /&gt;
            OleDbConnection connection1 = new OleDbConnection(connection1String);&lt;br /&gt;
            OleDbCommand command1 = new OleDbCommand(&amp;quot;select * from authors&amp;quot;, connection1);&lt;br /&gt;
            connection1.Open();&lt;br /&gt;
            OleDbDataReader reader1 = command1.ExecuteReader(CommandBehavior.CloseConnection);&lt;br /&gt;
            DataTable schemaTable = reader1.GetSchemaTable();&lt;br /&gt;
            textBox1.Text += schemaTable.Rows[0][0].ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
            textBox2.Text += schemaTable.Rows[1][0].ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
            textBox3.Text += schemaTable.Rows[2][0].ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
            textBox4.Text += schemaTable.Rows[3][0].ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
            while (reader1.Read())&lt;br /&gt;
            {&lt;br /&gt;
                if (schemaTable.Rows[0][5].ToString() == &amp;quot;System.String&amp;quot;) {&lt;br /&gt;
                    textBox1.Text += reader1.GetString(0) + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                if (schemaTable.Rows[0][5].ToString() == &amp;quot;System.Boolean&amp;quot;) {&lt;br /&gt;
                    textBox1.Text += reader1.GetBoolean(0).ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                if (schemaTable.Rows[1][5].ToString() == &amp;quot;System.String&amp;quot;) {&lt;br /&gt;
                    textBox2.Text += reader1.GetString(1) + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                if (schemaTable.Rows[1][5].ToString() == &amp;quot;System.Boolean&amp;quot;) {&lt;br /&gt;
                    textBox2.Text += reader1.GetBoolean(1).ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                if (schemaTable.Rows[2][5].ToString() == &amp;quot;System.String&amp;quot;) {&lt;br /&gt;
                    textBox3.Text += reader1.GetString(2) + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                if (schemaTable.Rows[2][5].ToString() == &amp;quot;System.Boolean&amp;quot;) {&lt;br /&gt;
                    textBox3.Text += reader1.GetBoolean(2).ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                    }&lt;br /&gt;
                if (schemaTable.Rows[3][5].ToString() == &amp;quot;System.String&amp;quot;) &lt;br /&gt;
                {&lt;br /&gt;
                    textBox4.Text += reader1.GetString(3) + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                if (schemaTable.Rows[3][5].ToString() == &amp;quot;System.Boolean&amp;quot;) {&lt;br /&gt;
                    textBox4.Text += reader1.GetBoolean(3).ToString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            reader1.Close();&lt;br /&gt;
            connection1.Close();&lt;br /&gt;
        }&lt;br /&gt;
  }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OleDbDataAdapter and SqlDataAdapter: Update==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
using System.Data.OleDb;&lt;br /&gt;
public class OleDbDataAdapterSqlDataAdapter : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private System.Windows.Forms.Button OleDbDataAdapter;&lt;br /&gt;
  private System.Windows.Forms.Button SqlDataAdapter;&lt;br /&gt;
  private System.Windows.Forms.DataGrid dataGrid1;&lt;br /&gt;
  private System.ruponentModel.Container components = null;&lt;br /&gt;
  public OleDbDataAdapterSqlDataAdapter()&lt;br /&gt;
  {&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  protected override void Dispose( bool disposing )&lt;br /&gt;
  {&lt;br /&gt;
    if( disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if (components != null) &lt;br /&gt;
      {&lt;br /&gt;
        components.Dispose();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    base.Dispose( disposing );&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.OleDbDataAdapter = new System.Windows.Forms.Button();&lt;br /&gt;
    this.SqlDataAdapter = new System.Windows.Forms.Button();&lt;br /&gt;
    this.dataGrid1 = new System.Windows.Forms.DataGrid();&lt;br /&gt;
    ((System.ruponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    // &lt;br /&gt;
    // OleDbDataAdapter&lt;br /&gt;
    // &lt;br /&gt;
    this.OleDbDataAdapter.Location = new System.Drawing.Point(16, 16);&lt;br /&gt;
    this.OleDbDataAdapter.Name = &amp;quot;OleDbDataAdapter&amp;quot;;&lt;br /&gt;
    this.OleDbDataAdapter.Size = new System.Drawing.Size(136, 32);&lt;br /&gt;
    this.OleDbDataAdapter.TabIndex = 0;&lt;br /&gt;
    this.OleDbDataAdapter.Text = &amp;quot;OleDb DataAdapter&amp;quot;;&lt;br /&gt;
    this.OleDbDataAdapter.Click += new System.EventHandler(this.OleDbDataAdapter_Click);&lt;br /&gt;
    // &lt;br /&gt;
    // SqlDataAdapter&lt;br /&gt;
    // &lt;br /&gt;
    this.SqlDataAdapter.Location = new System.Drawing.Point(176, 16);&lt;br /&gt;
    this.SqlDataAdapter.Name = &amp;quot;SqlDataAdapter&amp;quot;;&lt;br /&gt;
    this.SqlDataAdapter.Size = new System.Drawing.Size(168, 32);&lt;br /&gt;
    this.SqlDataAdapter.TabIndex = 1;&lt;br /&gt;
    this.SqlDataAdapter.Text = &amp;quot;SQL DataAdapter&amp;quot;;&lt;br /&gt;
    this.SqlDataAdapter.Click += new System.EventHandler(this.SqlDataAdapter_Click);&lt;br /&gt;
    // &lt;br /&gt;
    // dataGrid1&lt;br /&gt;
    // &lt;br /&gt;
    this.dataGrid1.DataMember = &amp;quot;&amp;quot;;&lt;br /&gt;
    this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;&lt;br /&gt;
    this.dataGrid1.Location = new System.Drawing.Point(16, 72);&lt;br /&gt;
    this.dataGrid1.Name = &amp;quot;dataGrid1&amp;quot;;&lt;br /&gt;
    this.dataGrid1.Size = new System.Drawing.Size(408, 192);&lt;br /&gt;
    this.dataGrid1.TabIndex = 2;&lt;br /&gt;
    // &lt;br /&gt;
    // OleDbDataAdapterSqlDataAdapter&lt;br /&gt;
    // &lt;br /&gt;
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(440, 273);&lt;br /&gt;
    this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                    this.dataGrid1,&lt;br /&gt;
                                    this.SqlDataAdapter,&lt;br /&gt;
                                    this.OleDbDataAdapter});&lt;br /&gt;
    this.Name = &amp;quot;OleDbDataAdapterSqlDataAdapter&amp;quot;;&lt;br /&gt;
    this.Text = &amp;quot;OleDbDataAdapterSqlDataAdapter&amp;quot;;&lt;br /&gt;
    ((System.ruponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new OleDbDataAdapterSqlDataAdapter());&lt;br /&gt;
  }&lt;br /&gt;
  private void OleDbDataAdapter_Click(object sender, System.EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        string ConnectionString = @&amp;quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb&amp;quot;;&lt;br /&gt;
        string SQL = &amp;quot;SELECT * FROM Customers&amp;quot;;&lt;br /&gt;
        OleDbConnection conn = new OleDbConnection(ConnectionString);&lt;br /&gt;
        conn.Open();&lt;br /&gt;
        &lt;br /&gt;
        OleDbDataAdapter adapter = new OleDbDataAdapter();&lt;br /&gt;
        adapter.SelectCommand = new OleDbCommand(SQL, conn);&lt;br /&gt;
    &lt;br /&gt;
        DataSet ds = new DataSet(&amp;quot;Customers&amp;quot;);         &lt;br /&gt;
        adapter.Fill(ds, &amp;quot;Customers&amp;quot;);&lt;br /&gt;
    adapter.DeleteCommand = new OleDbCommand(&amp;quot;DELETE * FROM Customers&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    adapter.Update(ds, &amp;quot;Customers&amp;quot;);&lt;br /&gt;
    dataGrid1.DataSource = ds.DefaultViewManager;&lt;br /&gt;
    }&lt;br /&gt;
  private void SqlDataAdapter_Click(object sender, System.EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
    &lt;br /&gt;
        string ConnectionString =&amp;quot;Integrated Security=SSPI;&amp;quot; +&lt;br /&gt;
            &amp;quot;Initial Catalog=Northwind;&amp;quot; +&lt;br /&gt;
            &amp;quot;Data Source=localhost;&amp;quot;;&lt;br /&gt;
        string SQL = &amp;quot;SELECT CustomerID, CompanyName FROM Customers&amp;quot;;&lt;br /&gt;
        SqlConnection conn = new SqlConnection(ConnectionString);&lt;br /&gt;
        conn.Open();&lt;br /&gt;
        SqlDataAdapter adapter = new SqlDataAdapter(SQL, conn);&lt;br /&gt;
        DataSet ds = new DataSet(&amp;quot;Customers&amp;quot;);&lt;br /&gt;
        adapter.Fill(ds);&lt;br /&gt;
        dataGrid1.DataSource = ds.DefaultViewManager;           &lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Read result set from OleDbDataReader==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.OleDb;&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
   static void Main(string[] args)&lt;br /&gt;
   {&lt;br /&gt;
      string connString = &amp;quot;provider=sqloledb;server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI&amp;quot;;&lt;br /&gt;
      string sql = @&amp;quot;select * from employee&amp;quot;;&lt;br /&gt;
      OleDbConnection conn = null;&lt;br /&gt;
      OleDbDataReader reader = null;&lt;br /&gt;
      try&lt;br /&gt;
      {&lt;br /&gt;
         conn = new OleDbConnection(connString);&lt;br /&gt;
         conn.Open();&lt;br /&gt;
         OleDbCommand cmd = new OleDbCommand(sql, conn);&lt;br /&gt;
         reader = cmd.ExecuteReader();&lt;br /&gt;
         Console.WriteLine(&amp;quot;Querying database {0} with query {1}\n&amp;quot;, conn.Database, cmd.rumandText );&lt;br /&gt;
         while(reader.Read()) {&lt;br /&gt;
            Console.WriteLine(&amp;quot;{0} | {1}&amp;quot;, reader[&amp;quot;FirstName&amp;quot;].ToString().PadLeft(10), reader[1].ToString().PadLeft(10));&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
      catch (Exception e)&lt;br /&gt;
      {&lt;br /&gt;
         Console.WriteLine(&amp;quot;Error: &amp;quot; + e);&lt;br /&gt;
      }&lt;br /&gt;
      finally&lt;br /&gt;
      {&lt;br /&gt;
         reader.Close();&lt;br /&gt;
         conn.Close();&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Typed Accessors==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
    class TypedAccessors&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            string connString = @&amp;quot;server = .\sqlexpress;integrated security = true;database = northwind&amp;quot;;&lt;br /&gt;
            string sql = @&amp;quot;select productname, unitprice, unitsinstock,discontinued from products&amp;quot;;&lt;br /&gt;
            SqlConnection conn = new SqlConnection(connString);&lt;br /&gt;
            try{&lt;br /&gt;
                conn.Open();&lt;br /&gt;
                SqlCommand cmd = new SqlCommand(sql, conn);&lt;br /&gt;
                SqlDataReader rdr = cmd.ExecuteReader();&lt;br /&gt;
                while (rdr.Read())&lt;br /&gt;
                {&lt;br /&gt;
                    Console.WriteLine(rdr.GetString(0));&lt;br /&gt;
                    Console.WriteLine(rdr.GetDecimal(1));&lt;br /&gt;
                    Console.WriteLine(rdr.GetInt16(2));&lt;br /&gt;
                    Console.WriteLine(rdr.GetBoolean(3));&lt;br /&gt;
                }&lt;br /&gt;
                rdr.Close();&lt;br /&gt;
            }&lt;br /&gt;
            catch (Exception e)&lt;br /&gt;
            {&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error Occurred: &amp;quot; + e);&lt;br /&gt;
            }&lt;br /&gt;
            finally&lt;br /&gt;
            {&lt;br /&gt;
                conn.Close();&lt;br /&gt;
            } &lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use to OleDbDataReader retrieve data==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.OleDb;&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
  static void Main(string[] args)&lt;br /&gt;
  {&lt;br /&gt;
        string ConnectionString = @&amp;quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb&amp;quot;;&lt;br /&gt;
        string SQL = &amp;quot;SELECT * FROM Orders&amp;quot;;&lt;br /&gt;
        OleDbConnection conn = new OleDbConnection(ConnectionString);       &lt;br /&gt;
        OleDbCommand cmd = new OleDbCommand(SQL);&lt;br /&gt;
        cmd.Connection = conn;&lt;br /&gt;
        conn.Open();&lt;br /&gt;
        OleDbDataReader reader = cmd.ExecuteReader();&lt;br /&gt;
        try &lt;br /&gt;
        {&lt;br /&gt;
            while (reader.Read()) &lt;br /&gt;
            {&lt;br /&gt;
                Console.Write(&amp;quot;OrderID:&amp;quot;+reader.GetInt32(0).ToString() );&lt;br /&gt;
                Console.Write(&amp;quot; ,&amp;quot;);&lt;br /&gt;
                Console.WriteLine(&amp;quot;Customer:&amp;quot; + reader.GetString(1).ToString() );&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        finally &lt;br /&gt;
        {&lt;br /&gt;
            reader.Close();&lt;br /&gt;
            conn.Close();&lt;br /&gt;
        }   &lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;OrderID:10330 ,Customer:LILAS&lt;br /&gt;
OrderID:10331 ,Customer:BONAP&lt;br /&gt;
OrderID:10332 ,Customer:MEREP&lt;br /&gt;
OrderID:10333 ,Customer:WARTH&lt;br /&gt;
OrderID:10334 ,Customer:VICTE&lt;br /&gt;
...&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>