Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2003, 10:51 PM
Authorized User
Join Date: Jun 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Bindind data-bound grids to ADO recordsets

I am having trouble setting the datasource property of the ADO grid control or the DataGrid control to a recordset, here is the situation.

Due to project limitations, I am not able to use a data control and then bind the grids to the actual data control. I've used the Active Data Objects(ADO) reference, (click project/references and put a checkc next to it). then fed the connection a conneectoin string, that all goes fine...then dim'd a recordset and gave it a valid SQL string. it returns the recordset properly, i tested it and it is getting the right data...the problem lies here.

I want to bind the recordset to a datagrid control(any of them)...but the datagrid controls only seem to want to be bound to actual data controls you draw on the form..(like the generic data control, or the ADO data control)...not the populated recordset.

I'm using "Microsoft DataGrid Control 6.0(sp5)"...attemping to bind it to a recordset created from the ADO reference, this is the error message I'm receiving:

Method or data member not found.

it's not expecting to receive a recordset like that.. if this helps, here is the prelimary code:
("rS" is a valid recordset btw)

rS.Open "SELECT * FROM INVENTORY", cOn, adOpenDynamic, adLockOptimistic, adCmdText
DataGrid1.DataSource = rS

bam...error right there. Anyone have any suggestions? Or perhaps know of a dataGrid control that will accecpt recordsets? Any help would really be appreciated.

Reply With Quote
  #2 (permalink)  
Old June 19th, 2003, 11:05 PM
Posts: n/a

I do this all the time with Sherdian data grid


set datagrid1.datasource = rs

since you are dealing with an object, use have to use the set keyword
Reply With Quote
  #3 (permalink)  
Old June 19th, 2003, 11:08 PM
Authorized User
Join Date: Jun 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

I tried that earlier tonight =o( I got an error I didn't understand, "the recordset is not bookmarkable" =o( Any experience with this?
Reply With Quote
  #4 (permalink)  
Old June 19th, 2003, 11:14 PM
Friend of Wrox
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post

Shouldn't that be:

Set DataGrid1.DataSource = rS

I think you have to use the 'set' command to set the datasource property to the reference to the recordset.

Jeff Mason
Custom Apps, Inc.
Reply With Quote
  #5 (permalink)  
Old June 19th, 2003, 11:17 PM
Authorized User
Join Date: Jun 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

Ack, sorry fellows. It was another error, my own mistake...trying to code while too tired. I had cut and pasted the code from an earlier project, and must have missed the line where i was setting cursorlocations... I figured it out when i just ran the old code and it worked..compared line by line until I found what I missed in my sleeplessness, thanks for all the help though ;]
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Proper" way of updating bound controls and grids VBM2 Pro Visual Basic 2005 1 March 12th, 2007 09:36 AM
Creating/Populating Recordsets in ADO dgulliver VB How-To 3 May 24th, 2006 03:31 AM
Nesting ADO recordsets yossarian Pro VB Databases 1 January 12th, 2005 06:28 PM
Data grids ?????? Louisa Beginning VB 6 1 November 18th, 2003 04:39 AM
Data Grids Louisa Beginning VB 6 1 October 17th, 2003 03:09 PM

All times are GMT -4. The time now is 10:34 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.