Using SQL statements in ASP 9: Form Actions

Source: Internet
Author: User
Statement to remove information from a page form is a common problem in ASP programming. But how long does it take to traverse a record that passes through a form? This depends on the size of the database. A simple GUI interface can take too much time on a looping traversal operation.

For example, suppose a team member logs on to the GUI screen and enters his or her first name with a dot connection: Amy.cowen. This value is submitted through the form, and her current project list is taken out of the database and displayed on the screen. To quickly remove a user's record for display on the screen, you can write the following code.

Suppose the HTML page contains the following code:
<form action= "login_post.asp" method= "POST" >
<input type= "text" name= "Dotname" >
<input type= "Submit" >
</FORM>

On your login_post.asp code page you want to read the value of the Dotname field and find the matching record in the database:
SQL = "Select Dotname, ID from team WHERE dotname = '" & Request.Form ("Dotname") & "'"

If you use the Get method, you need to compare the database records with the field values in QueryString, then you can use the same basic method:
SQL = "Select Dotname, ID from team WHERE dotname = '" & Request.QueryString ("Dotname") & "'"

Of course, you can also assign the value of a form field to a variable and insert it into your SQL statement:
Dotname = Request.QueryString ("Dotname")
SQL = "Select Dotname, ID from team WHERE dotname = '" & Dotname & "'"



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.