Hi Guys - newbie here..

I have been working with OLEDB connection for the past few weeks and now have this connection in ADO and i'm not sure how to proceed.

The Connection information is the following:

        private ADODB.Connection adoConn = new ADODB.Connection();
        private ADODB.Recordset adoRS = new ADODB.Recordset();

and then...

      public Form1()
        {
            InitializeComponent();

            //Opens Line 50 Connection//
            adoConn.Open("SageLine50v17", "Manager", "", 0);

            adoRS = adoConn.OpenSchema(ADODB.SchemaEnum.adSchemaTables, null, System.Reflection.Missing.Value);

            while (!(adoRS.EOF))
            {
                comboBox1.Items.Add(adoRS.Fields["TABLE_NAME"].Value.ToString());

                adoRS.MoveNext();
            }

            adoRS.Close();

        }

now currently this opens the Scheme for the Databse and populates the table names inside a drop-down combox.

What I was it to do is on connection fill a 'Datagridview' with the Table called 'Sales_Ledger'.

I'm a little confused on how to move forward on this due to the intelli-sense giving me differnt options to the OLEDB I have been using.

any help on this would be great! ^_^

Yay! Ok, I managed to get this working with a bit of help from the good old tinterweb!

If it's any help to anyone else this is how I overcome my problem

Code:

      private void radioBtnAcc_CheckedChanged(object sender, EventArgs e)
        {
            dataGridView1.ClearSelection();
            dataGridView2.ClearSelection();

            string query;

            System.Data.OleDb.OleDbDataAdapter custDA = new System.Data.OleDb.OleDbDataAdapter();
            DataSet accountsDS = new DataSet();
            DataTable accountsTable = new DataTable("accounts");

            accountsDS.Tables.Add(accountsTable);


            query = "SELECT ACCOUNT_REF AS ACCOUNT, NAME, ADDRESS_3 AS TOWN, ADDRESS_1, ADDRESS_2, ADDRESS_4, ADDRESS_5 FROM SALES_LEDGER";

            adoRS.Open(query, adoConn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, 1);
            custDA.Fill(accountsTable, adoRS);

            adoRS.Close();
            adoConn.Close();

            dataGridView1.DataSource = accountsDS.Tables[0];
            dataGridView1.Columns["ADDRESS_1"].Visible = false;
            dataGridView1.Columns["ADDRESS_2"].Visible = false;
            dataGridView1.Columns["ADDRESS_4"].Visible = false;
            dataGridView1.Columns["ADDRESS_5"].Visible = false;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.