CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2000
    Posts
    29

    Data grid and Ado

    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





  2. #2
    Join Date
    May 2001
    Posts
    40

    Re: Data grid and Ado

    what's your connection string look like? ie what's the value of conn?


  3. #3
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Data grid and Ado

    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

    Good Luck,
    -Cool Bizs

  4. #4
    Join Date
    Jul 2000
    Location
    Baton Rouge, Louisiana, USA
    Posts
    51

    Re: Data grid and Ado

    Did you cut and paste this code? If so, Recorset is spelled Recordset.

    patrick


  5. #5
    Join Date
    Aug 2000
    Location
    KY
    Posts
    766

    Re: Data grid and Ado


    '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





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured