Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2003, 03:46 PM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default Unable to call the date from the database

Now that the table is working I want to input the date that it was entered in the table as well. This is the error that appears.

Date:
ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/nvillare/guestbook.asp, line 25

How can I input the date into the database from a form and then call it from the database to show on a new page?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Guest Book</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<%
'set connection to access the database
set MyConn=Server.CreateObject("ADODB.Connection")

 MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("\nvillare\db\nidia.mdb"))

  mySQL = "SELECT theName, Email, Location, Comments FROM SignIn WHERE Post=yes ORDER BY ID DESC"

  set RS = MyConn.Execute(mySQL)

'make a table per entry until it has looped through the entire database
 While RS.Eof = false
%>

<table align="center" width="80%" border="1" bordercolor="#00CCCC" cellspacing="0" cellpadding="5">
  <tr>
    <td><b>Date:</b> <%=RS("theDate").Value%></td>
  </tr>
  <tr>
    <td><b>Name:</b> <%=RS("theName").Value%></td>
  </tr>

  <tr>
        <td><b>E-mail:</b> <a href="mailto:<%=RS("Email").Value%>"><%=RS("Email" ).Value%></a></td>
  </tr>

  <tr>
        <td><b>Location:</b> <%=RS("Location").Value%></td>
  </tr>

  <tr>
        <td><b>Comments:</b> <%=RS("Comments").Value%></td>
  </tr>
</table><p><p><p>
<%
   RS.MoveNext
   count = count + 1
   wend

  RS.Close
  RS = null
  MyConn.Close
  MyConn = null
%>
<center>Number of Entries = <%=count%></center>
</body>
</html>

Also, how do I get the count to show as 0 if there are no entries in the database?

Thanks for your help!



Nidia
__________________
Thanks!

N
 
Old July 9th, 2003, 03:49 PM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default

I figured out what the problem was but I still need help on inputting the date on a form and sending it to the database. I was thinking maybe a hidden field would work and then send that to the database but I am unsure of how to do that.

Does anyone have any ideas?

Thanks!

Nidia
 
Old July 10th, 2003, 04:44 PM
Authorized User
 
Join Date: Jul 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ALoPresto
Default

If you just want to input today's date to the database, use this:

<input type="hidden" name="thedate" value="<%Response.write(date)%>">

Then on the next page:

dim thedate
thedate = Request.Form("thedate")
...
objRS("thedate") = thedate
objRS.Update

-or-
...
objCommand.CommandText = "UPDATE table SET thedate = '" & thedate & "' WHERE id = " & id





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to create proper SOAP Header to call a web shashi.prakash Biztalk 5 July 31st, 2013 03:31 AM
Database call Wayne Fennell SQL Language 8 October 11th, 2007 08:41 AM
Basic- Making a template call / Date Arithmetic presack XSLT 2 August 3rd, 2007 01:33 PM
Unable to call function... rupen Javascript How-To 1 July 1st, 2006 04:53 AM
Call from database mikeholohan Classic ASP Basics 1 December 18th, 2003 04:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.