ASP depth revealed (next)

Source: Internet
Author: User
Iv. development and use of ASP components:
1. Features of the component?
L Advantages:
n easy to invoke, save code
N High Security
n supports transaction processing, multi-component syndication
N Run Fast
n Upgrade, modify components without modifying the page, so scalability is good
L Disadvantages:
n Development and debugging difficulties
2. How to use VB development?
⑴. Open Vb>>new Project>>activex DLL
⑵. Modify project name to course

⑶. Modify the name of the class module conn_db

⑷. Project>> References, referencing the COM + Service Type Library and Microsoft Active Server Pages Object Library.
⑸. Modify the class code as follows:
' Establish a database connection and output database fields
Dim Response as Response
Dim Request as Request
Dim Server as Server
Dim Application as Application
Dim Session as session

Private Sub Class_Initialize ()
Dim Objcontext as ObjectContext
Set objcontext = GetObjectContext ()
Set Response = objcontext ("Response")
Set Request = objcontext ("request")
Set Server = objcontext ("server")
Set application = objcontext ("Application")
Set session = Objcontext ("session")
End Sub
Sub conn_db ()
Set conn = CreateObject ("Adodb.connection")
Conn.Open "Course_dsn", "Course_user", "Course_password"
Set rs = CreateObject ("Adodb.recordset")
Rs.Open "SELECT * from User_info", Conn, 1, 1
If rs.recordcount > 0 Then
For i = 1 to Rs.recordcount
Response.Write "<br>" & RS ("user_name") & "<br>"
If Rs. EOF Then Exit for
Rs.movenext
Next
End If
Rs. Close
Set rs = Nothing
Conn. Close
Set conn = Nothing
End Sub
⑹. Add a new class Cutstr

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.