Click to See Complete Forum and Search --> : Data grid and Ado


Sheryl M
May 10th, 2001, 09:18 PM
Hi! I used an datagrid bound to an ado created run time. Whenever I set the the datasource of the grid run time, I encounter an error "The rowset is not bookmarkable." Hope you can help me. Posted below is my vb code. Thanks.


Dim rstTemp as ADODB.Recorset, strTemp as string

set rstTemp = new ADODB.Recorset
strTemp = MySQL

rstTemp.Open strTemp, conn
If rstTemp.BOF = true And rstTemp.EOF = true then
else

set dgdTemp.DataSource = rstTemp ' --- This is where the error occurs
End If

Z LoveLife
May 11th, 2001, 08:42 AM
what's your connection string look like? ie what's the value of conn?

coolbiz
May 11th, 2001, 08:59 AM
I don't think you can use the DataGrid control by itself (well I could not get it to work that way anyway). Add Microsoft ADO Data Control (ADODC) and then set the DataSource property of the DataGrid to the ADODC control. Once done, the following code should work:


private Sub ShowResult()
set rstTemp = new ADODB.Recorset
strTemp = MySQL
rstTemp.Open strTemp, conn

If Not rstTemp.EOF then
set ADODC.Recordset = rstTemp
End If
End Sub




-Cool Bizs

W P Hames
May 11th, 2001, 10:49 AM
Did you cut and paste this code? If so, Recorset is spelled Recordset.

patrick

dfwade
May 11th, 2001, 10:56 AM
'Open your Connection
Dim Conn as Connection
set Conn = new Connection
Conn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=false;Data Source=D:\win32app\Microsoft Visual Studio\VB98\Biblio.mdb"
'Open Your RecordSet
Dim rs as Recordset
set rs = new Recordset
'IMPORTANT set the Cursor Location to Client
rs.CursorLocation =adUseClient
rs.Open "Select * from Authors", Conn, adOpenKeyset, adLockReadOnly
'set the Grid Datasource property
set Grid.DataSource = rs