ASP components introductory and proficient series of five

Source: Internet
Author: User
Tags define function
Often we can see when connecting to a database, opening a recordset as follows:

Rs. Open strSQL, Conn,adopendynamic, adlockpessimistic

When you type "," a cursor type or a list of lock types appears later.

Sometimes we rs.open directly to simplify the strsql,conn,1,3

The first method is not more professional, we look at how ASP to achieve



Open VB6 and create a new ActiveX DLL project. Project name modified to fcom, class name modified to FC5

Option Explicit

' Define enum type

Public Enum Interfacedig

Icfirst = 1

Icsecond = 2

Icthree = 3

Icfour = 4

Icfive = 5

Icsix = 6

Icserven = 7

Iceight = 8

End Enum



' Define function

Public Function Calldat (ByVal idig as Integer, ByVal ICS as Interfacedig) as Variant

Calldat = Idig * ICS

End Function



OK, a component is written, click the menu-> file-> generate FCom.dll file

OK, there will be a FCom.dll file in the directory



Test

Turn on visual interdev6.0 to generate an ASP file



<%@ Language=vbscript%>

<HTML>

<BODY>

<%

' Definition, you can also put this part in a file, just like an ADO recordset <!--#include file= "Adovbs.inc"-->

Const ICFIRST = 1

Const ICSECOND = 2

Const ICTHREE = 3

Const ICFOUR = 4

Const ICFIVE = 5

Const ICSIX = 6

Const Icserven = 7

Const ICEIGHT = 8



Set Obj=server. CreateObject ("FCOM.FC5")

' Here you can use Iceight or 8, but the former makes the code more readable

A= obj. Calldat (4,iceight)

Response.Write A

Response.Write "<br>"

A= obj. Calldat (4,8)

Response.Write A

%>

<P> </P>



</BODY>

</HTML>



Configure the virtual directory, in IE to execute this ASP file, the results are as follows:

32
32



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