Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:
  #1  
Old 11-05-2009, 12:33 PM
fchevitarese fchevitarese is offline
Registered User
 
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.
Reply With Quote
  #2  
Old 11-05-2009, 01:04 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 11-05-2009, 03:12 PM
gibra's Avatar
gibra gibra is offline
Registered User
 
Join Date: Mar 2009
Location: Italy - Breganze (VI)
Posts: 75
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
Reply With Quote
  #4  
Old 11-06-2009, 01:19 PM
fchevitarese fchevitarese is offline
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks
I´ll do this now !
Reply With Quote
Reply

Bookmarks

Tags
datasource, dbgrid, recordset

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing datasource property of datagrid at runtime... premartha ASP.NET 1 11-19-2005 02:13 AM
print DbGrid problem mona&Shuhada VB Classic 0 04-27-2001 12:09 AM
Field limeted in DBGrid V5.0 or V6.0 Goran VB Classic 0 06-16-2000 09:19 AM
DBCombo in a DBGrid FOXFI VB Classic 1 06-08-2000 02:32 PM
Re: How to set the DataSource to UserControl Nick Koszykowski VB Classic 0 03-28-2000 03:21 PM


All times are GMT -4. The time now is 06:31 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.