Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VB Access
I want to populate datagrid use a SQL Query. I don't want to use ADODC kind of control.
Please suggest.
I wrote the coding but it's not working.
Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim str As String
str = "Select * from table1"
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb"
Set rs = db.Execute(str)
Set DataGrid1.DataSource = rs
Error is saying RowSet is not bookmarkable
Any other code segment will also helpful for me.
I just want to populate the datagrid using a SQL Query.

Please Help
Posted 8-Jun-11 11:11am
Edited 8-Jun-11 11:14am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can solve it by adding CursorLocation = adUseClient
   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
Sourav972 at 9-Jun-11 0:48am
can you tell me, what the above line will do?
Amit Kumar Tiwari at 9-Jun-11 4:26am
Read the article for detail @
Sourav972 at 9-Jun-11 12:07pm
Thank you so much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 431
1 Afzaal Ahmad Zeeshan 184
2 /\jmot 176
3 Sergey Alexandrovich Kryukov 175
4 Marcin Kozub 175
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,634
3 Maciej Los 5,024
4 Manas Bhardwaj 4,986

Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 8 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100