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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MODIFYING RECORDS

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a page that displays all the records in the database on an html page. For each record the road field is a hyperlink. When this link is clicked on a form is brought up with all the data from that record which the user can modify.

What I would like is, instead of a page that brings up all the records in the database, I want a little form that will allow me to search for a particular record, which I can then modify.

The code I have at the moment is below. What code do I need to add to make the search facility?

<html>
<head>
<title>Modifying Records</title>
<link rel=&quot;stylesheet&quot; href=&quot;index.css&quot; type=&quot;text/css&quot;>
</head>
<body bgcolor=&quot;White&quot; link=&quot;Red&quot; vlink=&quot;Yellow&quot; alink=&quot;Yellow&quot;>
<%
set conn=Server.CreateObject(&quot;adodb.connection&quot;)
conn.open &quot;property&quot;
set rs=Server.CreateObject(&quot;adodb.Recordset&quot;)
sqlstmt = &quot;SELECT * from details&quot;
rs.open sqlstmt, conn
If rs.eof then
response.write &quot;No records&quot;
response.write &quot;<br>Try again
Else
%>

<h4>&nbsp;Modifying Records</h4>

<table width=&quot;600&quot; border=&quot;0&quot; cellpadding=&quot;10&quot;>
<%
Do while not rs.eof

property_id = rs(&quot;property_id&quot;)
road = rs(&quot;road&quot;)
area = rs(&quot;area&quot;)
postcode = rs(&quot;postcode&quot;)
location = rs(&quot;location&quot;)
weekly_rental = rs(&quot;weekly_rental&quot;)
list_text = rs(&quot;list_text&quot;)
detail_text = rs(&quot;detail_text&quot;)
imageone = rs(&quot;imageone&quot;)
imagetwo = rs(&quot;imagetwo&quot;)
number_bedrooms = rs(&quot;number_bedrooms&quot;)
furnished = rs(&quot;furnished&quot;)



%>

<tr>
<td>

<a href=&quot;modify2.asp?property_id=<%= property_id %>&quot;><font size=&quot;3&quot;><%= Road %></font></a>

</td></tr><tr>
<td><%= area %></td></tr><tr>
<td><%= postcode %></td></tr><tr>
<td><%= location %></td></tr><tr>
<td><%= number_bedrooms %></td></tr><tr>
<td><%= furnished %></td></tr><tr>
<td>£<%= weekly_rental %>/wk</td></tr><tr>
<td><%= list_text %></td></tr><tr>
<td><%= detail_text %></td></tr><tr>
<td><%= imageone %></td></tr><tr>
<td><%= imagetwo %><p><hr></td>
</tr>
<%
rs.MoveNext
loop
End If
%>
</table>
</center>
</body>
</html>


Many thanks

James
 
This is some VBScript code I cut out of my .AS
P page that lets users key in a partnumber and or a description. They can key in any part of the part number or description and it will bring in all matches.
-----------------------------------------------
<%pnum=request.querystring(&quot;PartNumber&quot;)%>
<%desc=request.querystring(&quot;Description&quot;)%>
<%
Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Open &quot;driver=SQL Server;server=yourweb.com;uid=user;pwd=password;database=yourdatabase;&quot;
Set RS1 = Conn.Execute(&quot;SELECT [STOCK_CODE], [Description], [SELLING_PRICE] FROM [Copy-PartMaster Lite] Where [STOCK_CODE] Like N'&quot; & pnum & &quot;%' And [Description] Like N'&quot; & desc & &quot;%'&quot;)
%>
<%
If Not RS1.EOF Then
Do%>
<tr>
<td width=&quot;10%&quot; align=&quot;left&quot;>
<p align=&quot;center&quot;><input type=&quot;submit&quot; value='Add <%=RS1(&quot;STOCK_CODE&quot;)%>' name=&quot;addtopo&quot;></td>
<td width=&quot;18%&quot; align=&quot;left&quot;>
<p align=&quot;center&quot;><%Response.Write RS1(&quot;STOCK_CODE&quot;)%></td>
<td width=&quot;52%&quot; align=&quot;left&quot;>
<p align=&quot;center&quot;><%Response.Write RS1(&quot;Description&quot;) %></td>
<td width=&quot;12%&quot; align=&quot;right&quot;>
<p align=&quot;center&quot;><%Response.Write RS1(&quot;SELLING_PRICE&quot;) %></td>
<td width=&quot;8%&quot; align=&quot;right&quot;><input type=&quot;text&quot; name=&quot;Qty&quot; size=&quot;4&quot;>
<p align=&quot;center&quot;></td>
</tr>
<% RS1.Movenext
Loop Until RS1.EOF
Else

Response.Write(&quot;No records or something&quot;)
End If
%>
-----------------------------------------------
So the page prints a table showing all mtaches in the SQL Server 7 database

Note:
&quot;pnum&quot; and &quot;desc&quot; are passed parameters from the previous page as shown below:

<form action=&quot;partrespond2.asp&quot; method=get>
<p>Part number <INPUT NAME=&quot;PartNumber&quot; <size=&quot;12&quot;></p>
<p>Description <INPUT NAME=&quot;Description&quot;<size=&quot;20&quot;></p>
<INPUT TYPE=submit value=&quot;Find Parts&quot;><INPUT TYPE=reset>
</form>

So when the user clicks submit on this form it launches the second page above and the second page gets the pnum and desc in the request.querystring

[sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top