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!

Explanation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hie i just started to learn ASP and i need some explanation of the code below. For example the 1st line i know its to declare the variables for...It would be great if someone could help and explain the other lines to me. THANX.

<% DIM SQLtxt, MyRS, ITEM
SQLtxt = &quot;Select * from orders where orderid = &quot; & Request.Form(&quot;ordernumber&quot;)
set MyRS = mydb.Execute (SQLtxt)
if NOT MyRS.EOF then
SQLtxt = &quot;Select * From CustomerOrders WHERE ORDERID=&quot;& Request.Form(&quot;ordernumber&quot;)
SET MyRS = mydb.Execute (SQLtxt)%>
<body><form method=&quot;POST&quot; action=&quot;doit.asp&quot;>
<%FOR ITEM = 0 to MyRS.fields.count - 1
response.write MyRS.fields(ITEM).name & &quot;: &quot;
response.write MyRS.fields(ITEM).Value & &quot;&quot;
next
Session(&quot;OrderID&quot;) = MyRS(&quot;OrderID&quot;).Value %>
<input type=&quot;submit&quot; value=&quot;DeleteOrder&quot; name=&quot;deleteorder&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;Reset&quot;>
</form></body>
<% end if %>

 
<% DIM SQLtxt, MyRS, ITEM

'this string is a SQL Query that has the HTML Form element &quot;ordernumber&quot; appended to the string
SQLtxt = &quot;Select * from orders where orderid = &quot; & Request.Form(&quot;ordernumber&quot;)

'go and run the SQL query in the database
set MyRS = mydb.Execute (SQLtxt)

' has there been data returned from the above SQL query?
if NOT MyRS.EOF then
'this string is a SQL Query that has the HTML Form element &quot;ordernumber&quot; appended to the string
SQLtxt = &quot;Select * From CustomerOrders WHERE ORDERID=&quot;& Request.Form(&quot;ordernumber&quot;)

'go and run the SQL query in the database
SET MyRS = mydb.Execute (SQLtxt)%>

<body><form method=&quot;POST&quot; action=&quot;doit.asp&quot;>
<%FOR ITEM = 0 to MyRS.fields.count - 1
' writes out the data returned from the SQL query
response.write MyRS.fields(ITEM).name & &quot;: &quot;
response.write MyRS.fields(ITEM).Value & &quot;&quot;
next

' the OrderID value is saced in a session object (probably for future reference)
Session(&quot;OrderID&quot;) = MyRS(&quot;OrderID&quot;).Value %>
<input type=&quot;submit&quot; value=&quot;DeleteOrder&quot; name=&quot;deleteorder&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;Reset&quot;>
</form></body>
<% end if %>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top