Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old March 10th, 2004, 08:18 AM
Authorized User
 
Join Date: Mar 2004
Location: Plymouth, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes - the database is updated now, but as you say the changes arenot shown. When we click our 'submit' button the details are put into the database and the below error is shown:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/goinggoinggone/AddUser.asp, line 41

Where line 41 is still the highlighted text in our previous posting. No record is being deleted.

Thanks for your help with this by the way - you have been a great help to us!

  #12 (permalink)  
Old March 10th, 2004, 08:33 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah, that is the error I'd expect, and was what I was referring to in my previous post.

Here's what happens in pseudo code:

Open Recordset
Filter for User
If User Does not Exist Then
    Create User with INSERT statement
End If

At this point, the Recordset will not contain a record. The recordset was EOF (End of File initially), and will still be EOF, even after you have added a user with the INSERT statement. After the INSERT statement executed, the Recordset is *not* populated again to reflect the changes. So:

  For each strField in rsUsers.Fields
      strValue = strField.value

is likely to cause a problem because there is no current record. You'll have to open the Recordset again using its Open method, or you should reuse the stuff from the form (Request.Form("password")) etc in the case of a new user.

Does that make sense?

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #13 (permalink)  
Old March 10th, 2004, 09:13 AM
Authorized User
 
Join Date: Mar 2004
Location: Plymouth, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry but we dont follow what you mean in your previous message:
we now understand why the error is being shown, but how do we reuse the code (..Request.Form("password.. etc) and where abouts would we put it? Does it go in place of the strField.name stuff?


  #14 (permalink)  
Old March 10th, 2004, 09:28 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

(Is there a bunch of you, or are you pluralis majestatis?)

Anyway, what I meant is that with a new user, the rsUsers is EOF, so this code will fail:
Code:
For each strField in rsUsers.Fields
  strName = strField.Name
  strValue = strField.value
  Session(strName) = strValue
Next
If I understand your intentions correctly, you are putting the data for the user into Session variables. This allows you to use Session("EmailAddress") in other pages to retrieve someone's e-mail address, right?

Like I said, for new users this won't work because the recordset rsUsers is EOF. Instead you could do something like this:
Code:
If rsUsers.EOF Then
' New user, get the data from the form instead
Session("EmailAddress") = Request.Form("email")
... etc etc for the other fields
Else
  ' Esisting user, should be in the recordset
  For each strField in rsUsers.Fields
    strName = strField.Name
    strValue = strField.value
    Session(strName) = strValue
  Next
End If
' Redirect to MenuForRegisteredUsers here
Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #15 (permalink)  
Old March 10th, 2004, 09:52 AM
Authorized User
 
Join Date: Mar 2004
Location: Plymouth, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

lol - there are two of us. We will try that code and let you know how we get on (we have to go now)
thanks again for your help though

  #16 (permalink)  
Old March 12th, 2004, 07:03 AM
Authorized User
 
Join Date: Mar 2004
Location: Plymouth, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello, right we are up to having most things working BUT when we try to 'browselistings' we keep getting this error:

Microsoft VBScript runtime error '800a01a8'

Object required

/goinggoinggone/browselistings.asp, line 47

The file it refers to is below, with line 47 in red;


<HTML>
<HEAD>
<TITLE>Going Going GONE!!</TITLE>
</HEAD>

<BODY BGCOLOR="#003399" body bgproperties="fixed" background="backpic.jpg">
<BASEFONT FACE="Verdana" COLOR="#FF6600">
<CENTER><H1>Going Going GONE!! 'For Sale...'</CENTER>
<p><img border="0" src="logo.bmp" width="50" height="50"></p>

<CENTER><a href="MenuForRegisteredUsers.asp"><img border="0" src="Home.png" width="120" height="19"></a><a href="login.asp"><img border="0" src="Login.png" width="120" height="19"></a><a href="Register.asp"><img border="0" src="Register.png" width="120" height="19"></a><a href="browselistings.asp"><img border="0" src="Browse.png" width="120" height="19"></a><a href="http://www.guistuff.com/"><img border="0" src="http://www.guistuff.com/images/11dot.gif" width="1" height="1"></a><CENTER>
<%
  If Session("PersonID") <> "" Then
    Response.Write "<H3>Welcome " & Session("GivenName") & "</H3>"
  End If
%>
</CENTER>
<P>Here's a list of all the items that our users have made available for purchase:
</P>
<%
  Dim rsItems
  strSQL = "SELECT * FROM Item " & _
           "WHERE ExpirationDate > #" & FormatDateTime(Now,2) & "# " & _
           "AND ItemStatus = 'Active';"
  Set rsItems = Server.CreateObject("ADODB.Recordset")
  rsItems.Open strSQL, objConn

  If Not rsItems.EOF Then
    Response.Write _
      "<TABLE BORDER=""1"" CELLSPACING=""3"" CELLPADDING=""3"">" & _
      " <TR>" & _
      " <TH>Item ID"
               If Session("PersonID") <> "" Then
                 Response.Write "<BR>Click to Bid"
               End If
           Response.Write "</TH>" & _
      " <TH>Name</TH>" & _
      " <TH>Asking Price</TH>" & _
      " <TH>Listing Date</TH>" & _
      " <TH>Current Bid</TH>" & _
      " <TH>Bid Time</TH>" & _
      " </TR>"
       Response.Write "</TABLE>"
    rsItems.close
    Set rsItems = Nothing
 Do While Not rsItems.EOF <--------------------
      Response.Write "<TR ALIGN=CENTER>"
      If Session("PersonID") <> "" Then
        Response.Write _
          "<TD><A HREF=""Bid.asp?Item=" & rsItems("ItemID") & """>" & _
          rsItems("ItemID") & "</A></TD>"
      Else
        Response.Write "<TD>" & rsItems("ItemID") & "</TD>"
      End If
      Response.Write _
        "<TD>" & rsItems("ItemName") & "</TD>" & _
        "<TD>" & FormatCurrency(rsItems("AskingPrice")) & "</TD>" & _
        "<TD>" & FormatDateTime(rsItems("ListingDate"),2) & "</TD>" & _
      "</TR>"
      rsItems.MoveNext
    Loop
  Else
    Response.Write "<CENTER><H2>No items currently for sale</H2></CENTER>"
  End If
%>
<P>

</BODY>
</HTML>



We are unsure what 'object' is required, any help will be gratefully recieved! Thanks in advance

  #17 (permalink)  
Old March 12th, 2004, 10:26 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

The object rsItems is required. Take a look at this:

    rsItems.close
    Set rsItems = Nothing
Do While Not rsItems.EOF <--------------------

First you close the object, and then you set it to Nothing.
Nothing doesn't have an EOF property, so the code fails.
Don't close the Recordset until you're done with it.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 15 help kyledonmoyer BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 June 30th, 2007 08:06 AM
chapter 15 manal_sag BOOK: Beginning ASP 3.0 2 March 13th, 2006 04:48 PM
Chapter 15 rrlevron BOOK: Beginning ASP 3.0 0 November 17th, 2005 03:38 PM
chapter 15 manal_sag BOOK: Beginning ASP 3.0 1 June 18th, 2005 11:05 AM
chapter 15 manal_sag BOOK: Beginning ASP 3.0 0 April 22nd, 2005 02:23 PM



All times are GMT -4. The time now is 05:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.