我用EDITPLUS写了一个ASP组建,我现在想把他编译成DLL的,不过我没有装VB,还有其他的方法嘛?

解决方案 »

  1.   

    可以做成windows脚本组件
    给端例子<?xml version="1.0"?>
    <component><registration
    description="ALSASPGrid"
    progid="ALSASPGrid.WSC"
    version="1.00"
    classid="{2cc27d00-8966-11d4-a57d-0050043342a3}"
    >
    </registration><public>

    <property name="DSN"/>
    <property name="PASSWORD"/>
    <property name="USERNAME"/>
    <property name="NUMPERPAGE"/>
    <property name="TABLEBGCOLOUR"/>
    <property name="TABLEFGCOLOUR"/>
    <property name="TABLEBORDER"/>
    <property name="CELLPADDING"/>
    <property name="CELLBGCOLOUR"/>
    <property name="CELLFGCOLOUR"/>
    <property name="CELLSPACING"/>
    <property name="HEADFONTSIZE"/>
    <property name="BODYFONTSIZE"/>

    <property name="CRITERIA">
    <put/>
    </property>

    <property name="RETURNFIELDS">
    <put/>
    </property>

    <property name="CURPAGE">
    <put/>
    </property>

    <property name="SQL">
    <put/>
    </property>

    <property name="TABLENAME">
    <put/>
    </property>

    <property name="FIELDNAME">
    <put/>
    </property>

    <property name="STYPE">
    <put/>
    </property>

    <method name="DrawGrid">
    <PARAMETER name="SQL"/>
    <PARAMETER name="CURPAGE"/>
    </method>

    <method name="Search">
    <PARAMETER name="TABLENAME"/>
    <PARAMETER name="FIELDNAME"/>
    <PARAMETER name="CRITERIA"/>
    <PARAMETER name="STYPE"/>
    <PARAMETER name="RETURNFIELDS"/>
    </method>

    </public><implements type="ASP" id="ASP"/><script language="VBScript">
    <![CDATA[dim SQL
    dim DSN
    dim USERNAME
    dim PASSWORD
    dim CRITERIA
    dim CURPAGE
    dim TABLENAME
    dim FIELDNAME
    dim STYPE
    dim NUMPERPAGE
    dim RETURNFIELDSdim TABLEBGCOLOUR
    dim TABLEFGCOLOUR
    dim CELLBGCOLOUR
    dim CELLFGCOLOUR
    dim TABLEBORDER
    dim CELLPADDING
    dim CELLSPACING
    dim HEADFONTSIZE
    dim BODYFONTSIZE' Defaults
    NUMPERPAGE=12
    TABLEBGCOLOUR="BLACK"
    TABLEFGCOLOUR="WHITE"
    CELLBGCOLOUR="WHITE"
    CELLFGCOLOUR="BLACK"
    TABLEBORDER=0
    CELLPADDING=2
    CELLSPACING=1
    HEADFONTSIZE=1
    BODYFONTSIZE=1
    function put_SQL(newValue)
    SQL = newValue
    end functionfunction put_CRITERIA(newValue)
    CRITERIA = newValue
    end functionfunction put_CURPAGE(newValue)
    CURPAGE = newValue
    end functionfunction put_TABLENAME(newValue)
    TABLENAME = newValue
    end functionfunction put_FIELDNAME(newValue)
    FIELDNAME = newValue
    end functionfunction put_RETURNFIELDS(newValue)
    RETURNFIELDS = newValue
    end functionfunction put_STYPE(newValue)

    if newValue <> "OR" and newValue <> "AND" then
    STYPE = "OR"
    else
    STYPE = newValue
    end if

    end function
    Sub Search(TABLENAME, FIELDNAME, CRITERIA, STYPE, RETURNFIELDS)
    Dim CSplit
    Dim i
    Dim Query If CRITERIA = "" then
    Response.Write "You must specify some search criteria."
    Exit sub
    end if CSplit = Split(CRITERIA," ")

    if RETURNFIELDS = "" then
    Query = "SELECT * from " & TABLENAME & " where "
    else
    Query = "SELECT " & RETURNFIELDS & " from " & TABLENAME & " where "
    end if

    For i = lbound(CSplit) to ubound(CSplit)
    if i = 0 then
    Query = Query & FIELDNAME & " like '%" & CSplit(i) & "%'"
    else
    Query = Query & " " & STYPE & " " & FIELDNAME & " like '%" & CSplit(i) & "%'"
    end if
    next

    DrawGrid QUERY, 1

    End SubSub DrawGrid(SQL, CURPAGE)
    Dim Conn
    Dim RS
    Dim i
    Dim TotalPages
    Dim Count Set Conn = Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.Recordset")

    Conn.Open DSN, USERNAME, PASSWORD

    '---- Cursor Location Property
    RS.CursorLocation = 3 'adUseClient

    '---- Set the Cache Size
    RS.CacheSize = NUMPERPAGE

    '---- Open Recordset
    RS.Open trim(SQL), Conn, 1, 1

    if not RS.EOF then


    Rs.MoveFirst
    Rs.PageSize = NUMPERPAGE

    '---- Get the max number of pages
    TotalPages = Rs.PageCount

    '---- Set the absolute page
    Rs.AbsolutePage = CurPage


    Response.Write "<Table bgcolor=" & TABLEBGCOLOUR & " border=" & TABLEBORDER & " cellpadding=" & CELLPADDING & " cellspacing=" & CELLSPACING & ">"

    ' Field Names
    Response.Write "<tr>"
    For i = 0 to rs.fields.count-1

    Response.Write "<td><font face=""verdana,arial"" size=" & HEADFONTSIZE & " color=" & TABLEFGCOLOUR & "><b>" & ucase(RS.Fields(i).Name) & "</b></font></td>"

    next
    Response.Write "</tr>" & vbcrlf


    '---- Set Count to Zero
    Count=0

    do while not RS.EOF and Count < rs.PageSize

    Response.Write "<tr>"
    For i = 0 to rs.fields.count-1

    Response.Write "<td bgcolor=" & CELLBGCOLOUR & "><font face=""verdana,arial"" size=" & BODYFONTSIZE & " colour=" & CELLFGCOLOUR & ">" & RS.Fields(i).Value & "</font></td>"

    next
    Response.Write "</tr>" & vbcrlf

    Count=Count+1
    RS.Movenext
    loop

    Response.Write "</table><P>"

    ' ---- Surrounding Table
    Response.Write "<center><table border=0><tr><td>"

    ' ---- Previous/Next buttons
    if CURPAGE > 1 then

    '---- We are not at the beginning, show the previous button
    Response.Write "<form method=post>"
    Response.Write "<INPUT TYPE=HIDDEN NAME=SQL VALUE=""" & SQL & """>"
    Response.Write "<INPUT TYPE=HIDDEN NAME=CURPAGE VALUE=""" & CURPAGE-1 & """>"
    Response.Write "<INPUT TYPE=SUBMIT NAME=NAVI VALUE=PREV>"
    Response.Write "</form>"


    end if


    Response.Write "</td><td align=center><font face=""verdana,arial"" size=1><b>"
    Response.Write "Page " & CURPAGE & " of " & TotalPages
    Response.Write "</td><td align=right>"

    If CInt(CURPAGE) <> CInt(TotalPages) then

    '---- We are not at the end, show a next button
    Response.Write "<form method=post>"
    Response.Write "<INPUT TYPE=HIDDEN NAME=SQL VALUE=""" & SQL & """>"
    Response.Write "<INPUT TYPE=HIDDEN NAME=CURPAGE VALUE=""" & CURPAGE+1 & """>"
    Response.Write "<INPUT TYPE=SUBMIT NAME=NAVI VALUE=NEXT>"
    Response.Write "</form>"

    end if

    Response.Write "</td></tr></table></center>"


    else

    Response.Write "Your query returned nothing."

    end if

    Rs.Close
    Conn.Close
    Set Conn = Nothing end Sub
    ]]>
    </script></component>
      

  2.   

    http://www.ourfly.com/download/downloadlist.aspx?type=Asp
    Asp的网格控件(附文档说明) 上面的代码保存成*.wsc文件下面是asp调用的
    <HTML>
    <BODY>
    <font face="verdana,arial" size=1><h2>Customers</h2><form method=post>
    Enter criteria (separate with space)<br>
    <input type=text name=criteria size=25 value="<%=Request("Criteria")%>"><br>
    search type: <select name=stype><option selected>AND<option>OR</select>
    <input type=submit name=search value=SEARCH>
    </form>
    <P><%If Request.form("Search") <> "" or Request.form("Navi") <> "" then Set Grid = createObject("AlsASPGrid.WSC")
    Grid.DSN = "AppUsers"

    Grid.NumPerPage=10
    Grid.TableBGColour="NAVY"
    Grid.TableFGColour="LIGHTGREEN"
    Grid.CellBGColour="LIGHTBLUE"
    Grid.CellFGColour="NAVY"

    if Request.Form("Search") <> "" then

    '---- Sub Search(TABLENAME, FIELDNAME, CRITERIA, STYPE, RETURNFIELDS)
    Grid.Search "tblCustomers","StrCustomerName",Request.form("Criteria"),Request.form("Stype"),"StrCustomerName As Customer, StrCountry As Country"


    elseif Request.Form("Navi") <> "" then

    '---- Sub DrawGrid(SQL, CURPAGE)
    Grid.DrawGrid Request.form("SQL"), Request.form("CURPAGE")

    end if

    Set Grid = Nothing

    end if%></font>
    </BODY>
    </HTML>