Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How could I modify this code to ena

Status
Not open for further replies.

finnoscar

Technical User
Aug 17, 2002
55
0
0
GB
How could I modify this code to enable a user to update the pups available field

<BODY><TABLE BORDER=1>
<THEAD>
<TR>
<TH>BreederNo</TH>
<TH>Breeder Name</TH>
<TH>Phone No.</TH>
<TH>Address</TH>
<TH>Pups Available</TH>
</TR>
</THEAD>
<% var str_DogName = new String(Request.Form(&quot;DogName&quot;));
if (str_DogName! = &quot;undefined&quot;){
%>
<%
// Open connection to database, then populate a recordset with list of Breeders
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
var adoRecordSet;
var mySQL;
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL = 'SELECT BreederNo,BreederName,BrPhoneNo ,BrAddress, PupsAvailable' +
' FROM Breeders WHERE BreedName =&quot;' + str_DogName +'&quot;';
adoRecordSet = adoConnection.Execute(mySQL);

// Loop through recordset and write stock details out to page
while ( adoRecordSet.Eof == false )
{
%>
<TR>
<TD><%=adoRecordset(&quot;BreederNo&quot;).Value%></TD>
<TD><%=adoRecordSet(&quot;BreederName&quot;).Value%></TD>
<TD><%=adoRecordSet(&quot;BrPhoneNo&quot;).Value%></TD>
<TD><%=adoRecordSet(&quot;BrAddress&quot;).Value%></TD>
<TD><%=adoRecordset(&quot;PupsAvailable&quot;).Value%></TD>
<TD><A HREF=&quot;BookPup.asp?BreederNo=<%=adoRecordSet(&quot;BreederNo&quot;).Value%><!--mstheme--></font></TD> <TD><!--mstheme--><font face=&quot; Helvetica&quot; Arial,> Book pup</A></TD>

</TR>
<%
adoRecordSet.MoveNext();
}

// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
%>
</TABLE></BODY>
</HTML>

 
and then what happens in BookPup.asp?

<font face=&quot; Helvetica&quot; Arial,> may mess up something in there BTW.
 
This is the code I used to return a list of breeders for a particuar breed. The BookPup.asp part then allowed the user to add their name to a booking table so it is not relevant in this instance. I want to allow a breeder to update the PupsAvailable field which consists of text stating Yes or No. The following code is what I use to allow a breeder to view the details of those who have booked with them.

<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>
<meta name=&quot;Microsoft Theme&quot; content=&quot;indust 110, default&quot;>
</head>

<body>
<% var str_BreederNo = new String(Request.Form(&quot;BreederNo&quot;));
if (str_BreederNo! = &quot;undefined&quot;){
%>
<%
// Open connection to database, then populate a recordset with list of Breeders
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
var adoRecordSet;
var mySQL;
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL =' SELECT tblCustomer.*
FROM tblCustomer INNER JOIN tblProvBooking ON tblCustomer.CustomerNo = tblProvBooking.CustomerNo
WHERE (((tblCustomer.CustomerNo= [tblProvBooking].[CustomerNo]
AND((tblProvBooking.BreederNo) = [&quot;' + str_BreederNo +'&quot;]';
adoRecordSet = adoConnection.Execute(mySQL);

// Loop through recordset and write stock details out to page
while ( adoRecordSet.Eof == false )
{
%>
<table>
<TR>
<TD><%=adoRecordset(&quot;BreederNo&quot;).Value%></TD>
<TD><%=adoRecordset(&quot;CustomerNo&quot;).Value%></TD>
<TD><%=adoRecordSet(&quot;CName&quot;).Value%></TD>
<TD><%=adoRecordSet(&quot;CPhoneNo&quot;).Value%></TD>
<TD><%=adoRecordSet(&quot;CAddress&quot;).Value%></TD>
<TD><%=adoRecordset(&quot;BookingDate&quot;).Value%></TD>

</TR>
<%
adoRecordSet.MoveNext();
}

// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
%>
</table></BODY>
 
Could somebody please tell me how to allow a breeder to update the pups available field of their records in the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top