problem binding a datagrid to an ADO recordset

problem binding a datagrid to an ADO recordset

Post by Toby Mill » Thu, 17 Aug 2000 04:00:00



The app I'm writing uses a mouse-click to query a point on a map. The query
works fine and returns an ADO recordset of soil information. I want to use a
datagrid (or flexgrid if that's better) to display the results, but when I
try to bind the grid:

Set DataGrid1.DataSource = rstSoilSeries

I get the following error: "The rowset is not bookmarkable"

do I need to make changes to the type of recordset that I create?

Thanks,
Toby :)

 
 
 

problem binding a datagrid to an ADO recordset

Post by Vitali » Fri, 18 Aug 2000 09:07:06


Quote:>Set DataGrid1.DataSource = rstSoilSeries

>I get the following error: "The rowset is not bookmarkable"

>do I need to make changes to the type of recordset that I create?

>Thanks,
>Toby :)

What value has "CursorType"? If the value "CursorType" is equal
adOpenForwardOnly,
try to change it adOpenStatic.

Vitaliy

 
 
 

problem binding a datagrid to an ADO recordset

Post by Toby Mill » Fri, 18 Aug 2000 04:00:00


Hmmm... nope, now I'm getting a new error: Cannot initialise data bindings


Quote:> >Set DataGrid1.DataSource = rstSoilSeries

> >I get the following error: "The rowset is not bookmarkable"

> >do I need to make changes to the type of recordset that I create?

> >Thanks,
> >Toby :)

> What value has "CursorType"? If the value "CursorType" is equal
> adOpenForwardOnly,
> try to change it adOpenStatic.

> Vitaliy

 
 
 

problem binding a datagrid to an ADO recordset

Post by Vitali » Sat, 19 Aug 2000 07:35:29


Quote:>Hmmm... nope, now I'm getting a new error: Cannot initialise data bindings

Show me code of the recordset procedure.
I shall try to understand: where is your mistake

Vitaliy

 
 
 

problem binding a datagrid to an ADO recordset

Post by Toby Mill » Sat, 19 Aug 2000 04:00:00


Here is my code. The SQL Query works fine, and the list box is populated
with no problem, but when I set the datagrid datasource, I get the error
"The rowset is not bookmarkable". If I change the cursor to adOpenStatic, I
get the error "Cannot initialise data bindings".

 cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
D:\200003.44 CPNP Cleaning\EIS priority 2.mdb"
  cnn.Open
  strSQL = "SELECT lSoilSeries.SeriesName, lSoilSeries.FormName FROM
(lSoilSeries INNER JOIN" & _
  "(rrSoilS INNER JOIN kSoilSeries ON rrSoilS.SoilSID =
kSoilSeries.SoilSID)" & _
  "ON lSoilSeries.SeriesID = kSoilSeries.SeriesID)"
  strSQL = strSQL & " WHERE rrSoilS.SoilSID = " &
recs.Fields("SoilSID").Value

  Debug.Print strSQL

  List1.Clear

  rstSoilSeries.Open strSQL, cnn, adOpenDynamic, adLockReadOnly
  With rstSoilSeries
    Do Until .EOF
        List1.AddItem .Fields("FormName").Value & ": " &
.Fields("SeriesName").Value
        .MoveNext
    Loop
  End With

  Set DataGrid1.DataSource = rstSoilSeries
  DataGrid1.ReBind

 
 
 

problem binding a datagrid to an ADO recordset

Post by Vitali » Sun, 20 Aug 2000 07:16:37


Ok! Your code has little trouble :)

You didn't established CursorLocation property and (by default)
CursorLocation = adUseServer.

Now, try it:

Quote:> cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
> D:\200003.44 CPNP Cleaning\EIS priority 2.mdb"
> cnn.Open

[setup of the sql-string skipped]

Quote:> List1.Clear

  With rstSoilSeries
    .ActiveConnection = cnn
    .Source = strSQL
    .CursorLocation = adUseClient  ' <- your problem was here
    .CursorType = adOpenStatic
    .LockType = adLockReadOnly
    .Open
  End With

Quote:> With rstSoilSeries
>   Do Until .EOF
>     List1.AddItem .Fields("FormName").Value & ": " &

.Fields("SeriesName").Value

Quote:>     .MoveNext
>   Loop
> End With

> Set DataGrid1.DataSource = rstSoilSeries
> DataGrid1.ReBind

Good luck!
Vitaliy
 
 
 

1. How to bind ADO recordset to DataGrid?

I would want to bind an ADO recordset to a DataGrid during runtime to show
the records. How should I go about doing that? Please advise.

--
Always here, always there,
~Chee Seng~

"But let your 'Yes' be 'Yes', and your 'No', 'No'. For whatever is more than
these is from the evil one." - Matthew 5:37, NKJV

2. # of db servers

3. How to bind ADO Recordset to DataGrid?

4. reversing Engineering

5. ADO Recordset bind to Datagrid at runtime

6. slave printing on D3-NT

7. Binding The DataGrid With ADO Recordset

8. Rename NT Server With SQL6.5 Installed

9. Binding ADO recordset to a datagrid (VB6 SP3)

10. Multiselect problem with DataGrid Control (bound to ADO)

11. VB6, MTS, ADO, DataGrid Binding Problem?

12. Multiselect problem with DataGrid Control (bound to ADO)

13. VB6, MTS, ADO, DataGrid Binding Problem?