p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB Databases Basics (http://p2p.wrox.com/forumdisplay.php?f=82)
-   -   Bindind data-bound grids to ADO recordsets (http://p2p.wrox.com/showthread.php?t=758)

module0000 June 19th, 2003 10:51 PM

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.


n/a June 19th, 2003 11:05 PM

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

module0000 June 19th, 2003 11:08 PM

I tried that earlier tonight =o( I got an error I didn't understand, "the recordset is not bookmarkable" =o( Any experience with this?

Jeff Mason June 19th, 2003 11:14 PM

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.

module0000 June 19th, 2003 11:17 PM

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 ;]

All times are GMT -4. The time now is 12:25 PM.

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