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 June 18th, 2004, 02:37 AM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

This is the whole script of the 1 and only page. Sorry I am not much more help, but I am more of a beginer.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>

<title>Top Deck Cards - Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<%
        'Declare Varables
        Dim dbname
        Dim ObjConn
        Dim tdcaddnew
        Dim tdcupdate
        Dim tdcdelete
        Dim tdcGETnews
        Dim tdcVIEWdates

        'Open DSNless connection to the banner database
        dbName = "/fpdb/news.mdb"
        ObjConn= "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath(dbName)

        'Executes if AddNew Button was clicked
        If Not isEmpty(Request.Form("addnew")) Then
            Set tdcaddnew = Server.CreateObject("ADODB.RecordSet")
            tdcaddnew.Open "Select * from news_messages",objconn,1,2
            tdcaddnew.AddNew
            tdcaddnew("tdcmessage") = Request.Form("message")
            tdcaddnew("tdcdate") = Request.Form("startdate")
            tdcaddnew("tdcopendate") = Request.Form("startdate")
            tdcaddnew("tdcclosedate") = Request.Form("enddate")
            tdcaddnew.Update
            tdcaddnew.close
            Set tdcaddnew = nothing
        End If

        'Executes if Update Button was clicked
        If Not isEmpty(Request.Form("update")) Then
            set tdcupdate = Server.CreateObject("ADODB.RecordSet")
            tdcupdate.Open "Select * from news_messages where tdcnumber=" & Request.Form("dates"),objconn,1,2
            If Not tdcupdate.EOF Then
                tdcupdate("tdcmessage") = Request.Form("message")
                tdcupdate("tdcdate") = Request.Form("startdate")
                tdcupdate("tdcopendate") = Request.Form("startdate")
                tdcupdate("tdcclosedate") = Request.Form("enddate")
                tdcupdate.Update
            Else
                Response.Write("<b>No records were found to update</b>")
            End If
            tdcupdate.Close
            tdcupdate = nothing
        End If

        'Executes if Delete Button was clicked
        If Not isEmpty(request.Form("delete")) Then
            set tdcdelete = Server.CreateObject("ADODB.RecordSet")
            tdcdelete.Open "Select * from news_messages where tdcnumber=" & Request.Form("dates"), objconn,1,2
            If Not tdcdelete.EOF Then
                tdcdelete.Delete
            Else
                Response.Write("<b>No records were found to update</b>")
            End If
            tdcdelete.Close
            tdcdelete = nothing
        End If

        Set tdcGETnews = Server.CreateObject("ADODB.RecordSet")
        tdcGETnews.Open "Select * from news_messages order by tdcdate",ObjConn,1,2
    %>
<body onLoad="MM_preloadImages('/images/images/baseball_guy.gif')">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="246" rowspan="3"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image10','','/images/images/baseball_guy.gif',1)"><img src="/images/images/wizard_guy.gif" name="Image10" width="246" height="123" border="0"></a></td>
    <td width="60" height="66"><img src="/images/images/last_name.gif" width="60" height="66"></td>
    <td valign="top"> <div align="right"><strong>6238 Main
        Street<br>
        Downers Grove, IL 60516<br>
        </strong> <strong>(630) 435-9900</strong></div></td>
  </tr>
  <tr>
    <td height="26" colspan="2"><a href="http://www.topdeckcards.com/#"><img src="/images/images/welcome.gif" width="59" height="26" border="0" onMouseOver="showit(0)"></a><img src="/images/images/sports.gif" onMouseOver="showit(1)" width="48" height="26"><img src="/images/images/card_games.gif" onMouseOver="showit(2)" width="76" height="26"><img src="/images/images/other_games.gif" onMouseOver="showit(3)" width="81" height="26"><img src="/images/images/supplies.gif" onMouseOver="showit(4)" width="57" height="26"><a href="http://www.topdeckcards.com/events.asp"><img src="/images/images/events.gif" width="50" height="26" border="0" onMouseOver="showit(5)"></a><img src="/images/images/about_us.gif" width="62" height="26" border="0" onMouseOver="showit(6)"><img src="/images/images/links.gif" width="43" height="26" border="0" onMouseOver="showit(7)"><a href="/admin/welcome.asp"><img src="http://www.topdeckcards.com/images/images/admin.gif" width="42" height="26" border="0" onMouseOver="showit(8)"></a></td>
  </tr>
  <tr>
    <td height="31" colspan="2" background="/images/images/bar_background.gif"><div align="left" id="describe"onMouseover="clear_delayhide()" onMouseout="resetit(event)">
        <div align="left">
          <script language="JavaScript1.2">
/*
Tabs Menu (mouseover)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/
var submenu=new Array()
//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.
submenu[0]=''
submenu[1]='<b>Baseball Boxes</a> | Baseball Singles</a> | Basketball Boxes</a> | Basketball Singles</a> | Hockey Boxes</a> | Hockey Singles</a> | Football Boxes</a> | Football Singles</a> | Other Collectibles</a></b>'
submenu[2]='<b>Magic Boxes</a> | Magic Singles</a> | Warlord Boxes</a> | Warlord Singles</a> | MLB Showdown Boxes</a> | Magi Nation Boxes</a> | YuGiOh Singles</a> | Yu-Gi-Oh Boxes</a> | Yu-Gi-Oh Singles</a> | Pokemon Boxes</a></b>'
submenu[3]='<b>Dungeons & Dragons</a> | MechWarrior</a> | Hero Clix</a> | Mage Knight</a></b>'
submenu[4]='<b>All Supplies</a> | Card Board Boxes</a> | Carrying Cases</a></b>'
submenu[5]=''
submenu[6]=''
submenu[7]=''
submenu='<b><a href="http://www.topdeckcards.com/admin/mailing_edit.asp">Mailing List Editor</a> | <a href="http://www.topdeckcards.com/admin/mass_email.asp">Mass E-mailer</a> | <a href="http://www.topdeckcards.com/admin/event_edit.asp">Events Editor</a> | <a href="http://www.topdeckcards.com/admin/add_news.asp">News Editor</a></b>'
var delay_hide=1
/////No need to edit beyond here
var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""
function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}
function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}
function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
        </script>
        </div>
      </div></td>
  </tr>
</table>
<div align="center"><br>
  <br>
  <table width="600" cellpadding="0" cellspacing="0">
    <tr>
      <td width="9" height="27"><img src="/images/images/left_header.gif" width="9" height="27"></td>
      <td width="100%" height="26" background="/images/images/back_header.gif"><div align="center"><strong>Mailing
          List Editor</strong></div></td>
      <td width="9"><img src="/images/images/right_header.gif" width="9" height="27"></td>
    </tr>
  </table>
  <table width="600" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td bgcolor="#333333"><table width="100%" border="0" cellspacing="1" cellpadding="1">
          <tr>
            <td width="100%" bgcolor="#FFFFFF"><div align="center"><form method="POST" action="news_add.asp">
                  <br>
                  <%
        tdcVIEWdates=""
        Do While NOT tdcGETnews.EOF
        tdcVIEWdates=tdcVIEWdates & "<option value=" & tdcGETnews("tdcnumber") & ">" & tdcGETnews("tdcopendate") & " <---> " & tdcGETnews("tdcclosedate") & "</option>"
        tdcGETnews.MoveNext
        Loop
        Set tdcGETnews = nothing
      %>
                  <b> </b> <br>

      <select size="8" name="dates" onDblClick="submit()"><%=tdcVIEWdates %></select> <br>
      <input type="submit" value="View" name="View"></p>
      <%If NOT isEmpty(Request.Form("dates")) Then
        Set tdcGETnews = Server.CreateObject("ADODB.RecordSet")
        tdcGETnews.Open "Select * from news_messages Where tdcnumber=" & Request.Form("dates"),ObjConn,1,2
        If Not tdcGETnews.EOF Then
       %>
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="52%" id="AutoNumber1">
                    <tr>
                      <td width="34%" align="right"><b>Message:&nbsp;&nbsp;
                        </b> </td>
                      <td width="66%"> <input name="message" type="text" id="message" value="<%=tdcGETnews("tdcmessage") %>" size="30"></td>
                    </tr>
                    <tr>
                      <td width="34%" align="right" height="10"> <b>
                        Start Time:&nbsp;</b>&nbsp;</td>
                      <td width="66%" height="10" align="center"><div align="left">
                          <input name="startdate" type="text" id="startdate" value="<%=tdcGETnews("tdcopendate") %>" size="10">
                        </div></td>
                    </tr>
                    <tr>
                      <td align="right" height="10"><b>End
                        Date:&nbsp;</b>&nbsp;</td>
                      <td width="66%" height="10" align="center">
<div align="left">
                          <input name="enddate" type="text" id="enddate" value="<%=tdcGETnews("tdcclosedate") %>" size="10">
                        </div></td>
                    </tr>
                  </table>
      <p>
      <input type="hidden" name="Number" value=<%=tdcGETnews("tdcnumber") %>>
      <input name="addnew" type="submit" id="addnew" value="Add New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" value="Update" name="Update">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<input type="submit" value="Delete" name="Delete">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" value="Clear" name="Clear"><br>
      <br>
      &nbsp;</p>
      <%
        End If
        tdcGETnews.close
        Set tdcGETnews = nothing
        Else %>
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="52%" id="AutoNumber1">
                    <tr>
                      <td width="34%" align="right"><b><b>Message:&nbsp;&nbsp;
                        </b> </b></td>
                      <td width="66%"> <input name="message" type="text" id="message" size="30"></td>
                    </tr>
                    <tr>
                      <td width="34%" align="right" height="10"> <b>
                        </b><b>Start
                        Time:&nbsp;</b>&nbsp;</td>
                      <td width="66%" height="10" align="center"><div align="left">
                          <input name="startdate" type="text" id="startdate" size="10">
                        </div></td>
                    </tr>
                    <tr>
                      <td align="right" height="10"><b>End
                        Date:&nbsp;</b>&nbsp;</td>
                      <td width="66%" height="10" align="center">
<div align="left">
                          <input name="enddate" type="text" id="enddate" size="10">
                        </div></td>
                    </tr>
                  </table>
      <p>
      <input name="addnew" type="submit" id="addnew" value="Add New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" value="Clear" name="Clear">
                  </p>
        <%
        End If
        %>
 </form></div></td>
          </tr>
        </table></td>
    </tr>
  </table>
<p>&nbsp;</p></div>
</body>
</html>


  #12 (permalink)  
Old June 18th, 2004, 02:40 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: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Do you get the error the first time the page loads, or when you post it back to the server??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Might Be Wrong by Radiohead (Track 5 from the album: Amnesiac) What's This?
  #13 (permalink)  
Old June 18th, 2004, 02:43 AM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

only when i post it back to the server. You can actually view the page at http://www.topdeckcards.com/test/news_add.asp

  #14 (permalink)  
Old June 18th, 2004, 02:53 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: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

And can you see where exactly the error occurs?
When I look at your source, I can see the code that runs when you press the Update button. Inside that code, you're retrieving info from Request.Form("dates"), but from what I can see, that should return a valid value.

However, I find your code pretty hard to read. Without being rude, I find the page quite a mess with those zillion tags. If I were you, I'd clean up a little and restructure your page before you continue. Makes things much easier to develop and understand.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: 05 - You Would Know by Queens of the Stone Age (Track 5 from the album: Untitled) What's This?
  #15 (permalink)  
Old June 18th, 2004, 03:00 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: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I see you're getting a different error now about an object.

In the Update block, use Set to set the recordset to nothing:

Set tdcupdate = Nothing


Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Tender by Blur (Track 1 from the album: 13) What's This?
  #16 (permalink)  
Old June 18th, 2004, 10:50 AM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

i fixed it all. it 100% works now! Thanks for all your help. It now receives a value. Then i changed it to "set" and it worked! THANKS A BUNCH!

 


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
question maheshraju ASP.NET 2.0 Basics 3 March 13th, 2008 08:54 AM
Question Ashwini Classic ASP Databases 3 January 10th, 2006 07:20 AM
Question? Calibus Classic ASP Databases 8 August 6th, 2004 08:25 AM
a question gorji C++ Programming 2 August 11th, 2003 07:41 AM



All times are GMT -4. The time now is 11:41 AM.


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