If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Database = Web Page

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-22-09, 13:47
JoGo1 JoGo1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 6
Exclamation Database = Web Page

Please, read below and Help!!

This is what I have to do:
Download and install the PUBS database onto your computer. File for install script is instpubs.sql in course content.

Design a Web page(s) that accesses the PUBS database on your computer and does the following processing. The Course Documents section contains a zip file that contains a collection of sample programs to be used for this assignment. When you click on the link for this file, you need to choose the "Save" option and then save the file on your computer. After saving it, you may unzip it to get the files.

Accept the name of an author and determine if that author is in the database. If it is in the database, display the title ID, title, price, and publication date of all books written by that author on a separate screen. Display an error message otherwise. Also include a link that, when clicked, returns the user to the first screen.

Zip your files together and upload them in the Digital Drop Box.


This is what I have:
Page 1

<!-- HTML Code To Generate A Form and Accept an Author's Name -->
<!-- PASS 8 -->

<form action="Searched Authors.asp">
<h2>Searched Author's Name</h2>
<table>
<tr>
<td>
<input type="varchar(20)" name="au_fname" >&nbsp<input type="varchar(40)" name="au_lname" >
</td>
</tr>
<tr><td>&nbsp</td></tr>
<tr>
<td>
<input type="submit" name="submit" value="Lookup" >
</td>
</table>
</form>

Page 2
<!-- Author Seach in Database -->
<!-- PASS8-->

<table border="1" align="center" cellspacing=3 cellpadding=5>
<%
' ASP Code Starts Here

' Connect to the database
Set conn=Server.CreateObject("ADODB.Connection")
conn.open "DSN=instpubs.sql"

' Retrieve author's name

searchmyauthor = request("writer")

' Execute SQL Query To Get Author's info Obtaining a Result Set Called rp

set rp = conn.Execute("Select au_id from authors where au_fname = '" & au_lname = '" &_
searchmyauthor & "'")

' Check to see if result set is empty

if not rp.eof then
myname = rp("au_id")
else
myname = "Unknown"
end if

' Find info for author seleced

set rc = conn.Execute("SELECT title_id,title,price,pubdate FROM TITLES WHERE authors.au_id=titleauthor.au_id & titleauthor.title_id= titles.title_id'" &_
searchmyauthor & "'" )

' Prepared at their own house

if not rc.eof then
response.write( "<tr><td colspan=4><center> <font size=+2>Books Published By " &_
myname & "</font></center></td></tr>" )

' In this part, ASP sends all HTML code to browser as strings

do while not rc.eof
response.write("<tr><td>")
response.write(rc("title_id"))
response.write("</td><td>")
response.write(rc("title"))
response.write("</td><td>")
response.write(rc("price"))
response.write("</td></tr>")
response.write(rc("pubdate"))
response.write("</td></tr>")
rc.movenext
loop

else
response.write( "<tr><td colspan=2><center> <font size=+2>No Author foung with name provided " & searchmyauthor & "</font></center></td></tr>" )
end if

' Close connection and free memory
conn.Close
Set conn=Nothing



<a href="PASS 8(01).html">mypage</a>
%>
Reply With Quote
Reply

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On