Populate Datagrid (.NET 4.0) from ADODB Recordset (OLEDB 6.0)-VBForums
Results 1 to 3 of 3

Thread: Populate Datagrid (.NET 4.0) from ADODB Recordset (OLEDB 6.0)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2001
    Location
    South Africa
    Posts
    88

    Post Populate Datagrid (.NET 4.0) from ADODB Recordset (OLEDB 6.0)

    I have a very frustrating problem which is not funny to resolve. This is not supposed to have with Visual Studio 2010, NET framework 4.0. I have to be very efficient on this platform that Visual basic 6.0.

    The NET platform should be very interesting on C#, and Visual Basic languages.


    In Visual Basic 6.0, the Datagrid (OLEDB 6.0 version) could be populated easily using the ADODB.Recordset object by using the following line code:-

    Code:
    Datagrid.DataSource = Recordset
    Combining the new Datagrid on NET framework 4.0 and ADODB.Recordset object becomes a little tedious. All this is done in Visual Studio 2010. This Datagrid cannot be populated by a simple line of code from ADODB.Recordset object, Why not?

    Code:
    Datagrid.DataSource = Recordset
    The above code does not work anymore, the Datagrid stays empty even though the Debug show the Datagrid has got some data from Recordset DataSource. The following code lines were tried and never worked as well:-

    Code:
    DataSet.DataSource = Recordset
    Datagrid.DataSource = DataSet
    Or

    Code:
    DataBinding.DataSource = Recordset
    Datagrid.DataSource = DataBinding
    DataBinding property was also selected in the properties page. The Datagrid remains empty.

    I am not sure what the problem is, but, I think the COM objects and the NET framework 4.0 objects in Visual Studio 2010 are not compatible with each other.
    The ADODB.Recordset object do not work well with the NET framework 4.0 Data objects. This is not good at all.

    The only way out for me is to use the Add items method using the items from the ADODB.Recordset to add them individually into the NET framework 4.0 Datagrid which is cumbersome code because I need to use For Loops statement etc. This is not good programming practice.

    I feel like I am going backwards when I am supposed to be moving forward. I use Visual studio 2010 for C# and Visual basic and this should be more fun than Visual basic 6.0 and previous C# 2008 etc. I cannot rely entirely on managed NET framework objects and classes only. I need to use all the objects available to my disposal to programme and come up with powerful Microsoft applications.

    I need assitance. Thank you in advance.

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    2,056

    Re: Populate Datagrid (.NET 4.0) from ADODB Recordset (OLEDB 6.0)

    My advise would be to forget about using ADODB Recordsets in .Net. They are great for VB6 but ADO .Net is what you should be using for VB .Net. Also, are you really talking about a DataGrid or do you mean DataGridView.

    If your just staring then this could be helpful. http://msdn.microsoft.com/en-us/vstu...#formsoverdata

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2001
    Location
    South Africa
    Posts
    88

    Re: Populate Datagrid (.NET 4.0) from ADODB Recordset (OLEDB 6.0)

    Quote Originally Posted by wes4dbt View Post
    My advise would be to forget about using ADODB Recordsets in .Net. They are great for VB6 but ADO .Net is what you should be using for VB .Net. Also, are you really talking about a DataGrid or do you mean DataGridView.

    If your just staring then this could be helpful. http://msdn.microsoft.com/en-us/vstu...#formsoverdata
    I mean DataGridView.
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.