1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

error when populating a datagrid

Discussion in 'Programming' started by MJS, May 15, 2005.

  1. #1
    Help :?)

    I am trying to populate a datagrid without using adodc datacontrol

    Here I opened a data connection and returned a record set.
    the record set populated a combo box
    On selection of combo item,
    Open a connection
    execute a command (call stored procedure)
    the recordset is populated

    rowset is not bookmarkavble

    The datagrid datasource statement is the culprit.



    Private Sub Combo1_Click()

    ' Capture the Parameter to be passed to the stored procedure
    ' Define Command
    Provider = "Provider=SQLOLEDB.1;"
    Security = "Integrated Security=SSPI;Persist Security Info=False;"
    Initial_Catalog = "Initial Catalog=inventory;"
    Data_Source = "Data Source=BLUE"

    ' Establish a connnection
    Set oConn = New ADODB.Connection
    oConn.ConnectionString = Provider & Security & Initial_Catalog & Data_Source
    oConn.Open

    ' Open a RecordSet
    Set oRs = New ADODB.Recordset

    Set oComm = New ADODB.Command
    oComm.ActiveConnection = oConn
    oComm.CommandType = adCmdStoredProc
    ' set stored procedure
    oComm.CommandText = "sp_IdrHeading"

    oRs.CursorLocation = adUseClient
    oRs.CursorType = adOpenDynamic
    oRs.LockType = adLockOptimistic

    ' Call Stored Procedure with parameter
    Set oRs = oComm.Execute(, Combo1.Text)
    oRs.MoveFirst


    Set DataGrid1.DataSource = oRs

    Error: rowset is not bookmarkable
     
    MJS, May 15, 2005 IP
  2. warit

    warit Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You have to config on the connection too.

    oConn.Cursorlocation = adUseClient


    Regards,
     
    warit, Aug 9, 2005 IP