DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    2

    Question DbGrid + DataSource

    Hello!
    I have to maintain in an old code here, and I have to migrate the database "Access" to "MSSQL".
    So far so good ... The consultations, inclusions and exclusions are all done.
    The problem is that there is a "DBGrid" here, that takes a "data" object as "DataSource".
    This object in turn, opened a database "access", carrying a table and populate the "DbGrid.
    I would like this populate this "DBGrid" using a "Recordset". Itīs possible?

    For thus, I would do the query and populate a "grid" with the result.

    Thanks.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,651
    I wouldn't use a grid as a replacement, I'd use a ListView which is easily populated using a recordset.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Mar 2009
    Location
    Italy - Breganze (VI)
    Posts
    120
    DBGrid is obsolete.
    Use DataGrid, instead.

    Using ADO become simple to populate DataGrid with a ADO recordset (without a DAO Data control or ADO Data control).

    Create your ADO Recordset then assign them to DataGrid:

    Code:
    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset
    Set cn = new ADODB.Connection
    Set rs = new ADODB.Recordset
    
    cn.ConnectionString = <your_string_database_connection>
    cn.CursorLocation = adUseClient
    cn.open
    
    rs.Open "SELECT * FROM table_name", cn, adForwardOnly, adReadOnly, adCmdText
    
    Set DataGrid1.DataSource = rs

  4. #4
    Join Date
    Nov 2009
    Posts
    2
    Thanks
    I&#180;ll do this now !

Similar Threads

  1. Replies: 1
    Last Post: 11-19-2005, 01:13 AM
  2. print DbGrid problem
    By mona&Shuhada in forum VB Classic
    Replies: 0
    Last Post: 04-26-2001, 11:09 PM
  3. Field limeted in DBGrid V5.0 or V6.0
    By Goran in forum VB Classic
    Replies: 0
    Last Post: 06-16-2000, 08:19 AM
  4. DBCombo in a DBGrid
    By FOXFI in forum VB Classic
    Replies: 1
    Last Post: 06-08-2000, 01:32 PM
  5. Re: How to set the DataSource to UserControl
    By Nick Koszykowski in forum VB Classic
    Replies: 0
    Last Post: 03-28-2000, 02:21 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links