Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: Rowset does not support scrolling backward


Message #1 by "Eric Douglas" <eld@s...> on Thu, 28 Jun 2001 10:03:06 -0700
I need some help. What do you do when you get a message like the one 

below?



Error Type:

Microsoft JET Database Engine (0x80040E29)

Rowset does not support scrolling backward.



It refers to the following bloc of code:



If Session("CustNo") =3D3D "" Then

  Dim objRec  ' recordset object

  Dim objCn

  Set objRec =3D3D CreateObject ("ADODB.Recordset")

  set objCn =3D3D CreateObject ("ADODB.Connection")

  objCn.Open strConnect

  objRec.Open "Customers", objCn, adOpenStatic, adLockPessimistic, =3D

adCmdTable

  objRec.Find "CustName =3D3D '" & Request.Form("Name") & "'"

  If objRec.EOF Then

   objRec.AddNew

   objRec("CustName") =3D3D Request.Form("Name")

   objRec("CustCity") =3D3D Request.Form("City")

   objRec("CustState") =3D3D Request.Form("State")

   objRec("CustZip") =3D3D Request.Form("Zip")

   objRec.Update

  End If



I would appreciate your help.



ED



Message #2 by "Ken Schaefer" <ken@a...> on Fri, 29 Jun 2001 01:00:55 +1000
My guess is that the error is being caused because you are getting an

adOpenKeyset cursor, not the requested adOpenStatic cursor:

http://www.adopenstatic.com/faq/jetcursortypes.asp



That said, I'd change the code works. What I'd do is create an SQL statement

that attempts to select the record in question:



strSQL = "SELECT * FROM Customers WHERE CustName = '" &

Replace(Request.Form("Name"), "'", "''") & "'"



objRS.Open strSQL, objConn, adOpenKeySet, adLockOptimistic, adCmdText



If objRS.EOF then

    objRS.AddNew

    ...

    ...

    ...

End If



This way, instead of pulling the whole table over into ASP, and then

attempting to see if there is a CustName that matches, you are getting the

database to do the search - much more efficient. If the database find a

match, we don't add a record. if the database doesn't, then we do add the

record.



Cheers

Ken





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "Eric Douglas" <eld@s...>

To: "ASP Database Setup" <asp_database_setup@p...>

Sent: Friday, June 29, 2001 3:03 AM

Subject: [asp_database_setup] Rowset does not support scrolling backward





I need some help. What do you do when you get a message like the one below?



Error Type:

Microsoft JET Database Engine (0x80040E29)

Rowset does not support scrolling backward.



It refers to the following bloc of code:



If Session("CustNo") =3D "" Then

  Dim objRec  ' recordset object

  Dim objCn

  Set objRec =3D CreateObject ("ADODB.Recordset")

  set objCn =3D CreateObject ("ADODB.Connection")

  objCn.Open strConnect

  objRec.Open "Customers", objCn, adOpenStatic, adLockPessimistic, 

adCmdTable

  objRec.Find "CustName =3D '" & Request.Form("Name") & "'"

  If objRec.EOF Then

   objRec.AddNew

   objRec("CustName") =3D Request.Form("Name")

   objRec("CustCity") =3D Request.Form("City")

   objRec("CustState") =3D Request.Form("State")

   objRec("CustZip") =3D Request.Form("Zip")

   objRec.Update

  End If



I would appreciate your help.



ED





---

STAY UP TO DATE ON ASP.NET, C#, VB.NET, SQL and XML

Developersdex indexes over 100 of the top ASP, SQL, VB

and XML sites bringing in more than 5,000 new resources

every day.  They even integrate all the top .NET

newsgroups so you can search/post/reply across

multiple newsgroups within their site.  The next time

you want to find an answer on ASP, C#, SQL, VB or XML

think of Devdex!  http://www.developersdex.com/




$subst('Email.Unsub')




  Return to Index