Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2003, 06:37 PM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to roykennedy
Default Binding a datagrid to a recordset

I have the following code in my application.

Code:
Dim cnOrganize As Connection
Dim rsFile As Recordset

Set cnOrganize = New Connection
cnOrganize.Open [Connection String]

Set rsFile = New Recordset
rsFile.Open "Files", cnOrganize, adOpenForwardOnly, adLockOptimistic

Set DataGrid1.DataSource = rsFile

rsFile.close
set rsFile = nothing

cnOrganize.close
set cnOrganize = nothing
When it gets to the line setting the datasource for the datagrid I get the following error.

'7004' The rowset is not bookmarkable

Is there a way that I can bind the datagrid to the recordset?
 
Old October 11th, 2003, 09:10 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe that you can not bind a adOpenForwardOnly recordset to a datagrid. Try using adOpenDynamic.



Sal
 
Old October 11th, 2003, 10:16 PM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to roykennedy
Default

I tried changing it to adOpenDynamic with no luck. Thanks for the response.

After reading your reply I tried other settings and adOpenKeyset worked. Thanks, I never would have thought of changing that.
 
Old October 16th, 2003, 12:31 AM
Authorized User
 
Join Date: Jun 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just set rstFile u need to change the cursor location to the client object. Meaning try something like this i hope this helpful.

Set rsFile = New Recordset
rstFile.cursorLocation = = adUseClient
rsFile.Open "Files", cnOrganize, adOpenForwardOnly, adLockOptimistic

Hope it's not too late!!


LION OF JUDDAH!
 
Old October 28th, 2005, 02:15 PM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks chiefouko! I would never have thought to change that setting and it worked the first time afterwards.






Similar Threads
Thread Thread Starter Forum Replies Last Post
binding on listbox in datagrid sunil131 VB Databases Basics 0 April 29th, 2007 06:11 AM
Binding a datagrid on errors drono ASP.NET 1.0 and 1.1 Professional 3 June 9th, 2005 08:30 AM
binding recordset with combo problem emachines Access VBA 1 February 28th, 2005 04:10 PM
DataGrid Binding GrindCrusher Classic ASP Databases 0 February 21st, 2004 05:52 PM
Binding an aarraylist to a datagrid Delano ADO.NET 2 September 22nd, 2003 05:20 AM





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