ADO : Cursor Type selection

Results 1 to 2 of 2

Thread: ADO : Cursor Type selection

  1. #1
    Join Date
    Dec 1969

    Default ADO : Cursor Type selection

    Chaps,<BR><BR>I am trying to select the cursor type when opening a recordset using a Command object with a Parameter appended to it, but it doesn&#039;t seem to be playing ball. No matter what I do, it always comes back with a Forward Only cursor (the default) when I try to append a parameter. It works fine when running a stored procedure with no parameters...Here is the code...<BR><BR>Dim cnn : Set cnn = Server.CreateObject("ADODB.Connection")<BR>Dim cmd : Set cmd = Server.CreateObject("ADODB.Command")<BR>Dim rs : Set rs = Server.CreateObject("ADODB.Recordset")<BR>Dim param<BR><BR>Dim strSearch : strSearch = ""<BR><BR>cnn.ConnectionString = Application("ConnDVD_ConnectionString")<BR>cnn.Ope n<BR>cnn.CursorLocation = adUseServer<BR><BR>With cmd<BR> .ActiveConnection = cnn<BR> .CommandType = adCmdStoredProc<BR> .CommandText = "spGetDetails" <BR>End With<BR><BR>Set param = cmd.CreateParameter("search", adVarChar, adParamInput, 100, strSearch) <BR>cmd.Parameters.Append param<BR><BR>rs.CursorType = adOpenDynamic<BR>rs.Open cmd<BR><BR>Response.Write "Cursor Type : " & rs.CursorType & "<BR>"<BR>Response.Write "Cursor Location : " & rs.CursorLocation & "<BR>"<BR><BR>Response.End<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ADO : Cursor Type selection

    &nbsp;<BR>Command.Execute() always returns a forward-only, read-only cursor. If you want to use any other cursor type then you&#039;ll have to explicitly use a Recordset object.<BR><BR>Chris

Posting Permissions

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