ASP tutorial: Deleting records and linking to a database program explanation

Source: Internet
Author: User
Tags array variables string split variable trim

First, delete records

Opendataconn ' Open database connection
Xxlb=rtnreplaceint (Trim (Request ("Xxlb")), 0) ' in order to receive the XXLB variable, remove the space at both ends of the variable, the outermost is a custom function, estimated with the replacement.
ID=CHANGECHR (Request ("id")) ' receives ID and converts it to a string
Ids=split (ID, ",") ' Press ID ', ' Split, and save to array IDs
For i=0 to UBound (IDs) ' Iterate through an array with a For loop
Tt=trim (IDs (i)) ' array element removes both ends of space and assigns the value to TT
Conn.execute "Delete from house where id=" &tt& "' Deletes records of ID=TT variables in a datasheet
Next ' Loop ends
Response.Redirect "house.asp?xxlb=" &xxlb& "" jumps to the House page and passes the XXLB parameter with the Get method, which is the value of the XXLB variable.
Closedataconn Close the database connection

Second, the connection database

Dim conn ' Defines a variable
Dim char_str (20) ' defines an array
Sub Opendataconn () custom process, user linked to database
Dim connstr Define Variables
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data source="
ConnStr = connstr & Server.MapPath (".. /.. /data/fyhouse_free.mdb ")" Database-driven string
' Response.Write connstr output variable connstr value
Set Conn=server.createobject ("Adodb.connection") ' Create a Connection object
Conn. Open connstr ' linked database
End Sub is the closing of the process, but it doesn't begin with the code you posted.

Related Article

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: 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.