Can anyone help me with rs.Open?

Results 1 to 2 of 2

Thread: Can anyone help me with rs.Open?

  1. #1
    Join Date
    Dec 1969

    Default Can anyone help me with rs.Open?

    I am doing some error trapping after my database connection using the following method:<BR><BR>rs.Open sql, conn, 1, 3, 1<BR>function errChk()<BR>if Err.number &#062; 0 then<BR>Err.Clear<BR>errChk = true<BR>elseif conn.Errors.Count &#062; 0 then<BR>conn.Errors.Clear<BR>errChk = true<BR>else<BR>errChk = false<BR>end if<BR>end function<BR><BR>if errChk() then<BR>conn.Close<BR>set conn = nothing<BR>Response.Write "Error"<BR>Response.End<BR>end if<BR><BR>When I am using an ADO Recordset to open a sql statement that pulls from either a table or view, I get a conn.Error.Count of 2.<BR>When I print out the descriptions I get the message "Cursor type changed" and "Cursor concurrency changed". When I leave out the error trapping function the page works fine and I have always used rs.Open with a cursor type of 1 and a LockType of 2 or 3. Well the only way I can get around the conn.Errors I&#039m getting is to use a Cursor Type of 0, 2, or 3. But 1 (AdOpenKeySet) is the most ideal because it allows the recordset to be updated if another user has deleted or changed a record, therefore being less taxing on the server than 2 (AdOpenDynamic). Unfortunately 1 is the only one giving me the error, also if I do a <BR>Response.Write rs.CursorType <BR>after the open statement it tells me that the cursortype is 3. Basically I need to know why using the AdOpenKeySet is causing a connection error and why it changes itself to a cursortype of 3 (adOpenStatic). Any help is appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: Can anyone help me with rs.Open?

    You shouldn&#039t check for errors using conn.Errors.count - there are almost always some wierd things going on there that you don&#039t really need to know about. Just check Err.number &#060;&#062; 0 (thats the ASP Err object, not conn.Error).<BR><BR>Dunc

Posting Permissions

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