ASP programming for parametric retrieval of new instance code

Source: Internet
Author: User

<%


' ************ Define constants *******************


'----parameterdirectionenum Values----


Const adparamunknown = & H0000


Const adparaminput = & H0001


Const adparamoutput = & H0002


Const adparaminputoutput = & H0003


Const adparamreturnvalue = & H0004





'----commandtypeenum Values----


Const adCmdUnknown = & H0008


Const adCmdText = & H0001


Const adcmdtable = & H0002


Const adCmdStoredProc = & H0004


Const adcmdfile = & H0100


Const adCmdTableDirect = & H0200





'----datatypeenum Values----


Const adempty = 0


Const adtinyint = 16


Const adsmallint = 2


Const adinteger = 3


Const adbigint = 20


Const adunsignedtinyint = 17


Const adunsignedsmallint = 18


Const adunsignedint = 19


Const adunsignedbigint = 21


Const adsingle = 4


Const addouble = 5


Const adcurrency = 6


Const addecimal = 14


Const adnumeric = 131


Const Adboolean = 11


Const aderror = 10


Const aduserdefined = 132


Const advariant = 12


Const adIDispatch = 9


Const adIUnknown = 13


Const adguid = 72


Const addate = 7


Const addbdate = 133


Const addbtime = 134


Const adDBTimeStamp = 135


Const adbstr = 8


Const Adchar = 129


Const adVarChar = 200


Const adLongVarChar = 201


Const Adwchar = 130


Const adVarWChar = 202


Const adLongVarWChar = 203


Const adbinary = 128


Const advarbinary = 204


Const adlongvarbinary = 205


Const adchapter = 136


Const adfiletime = 64


Const adpropvariant = 138


Const advarnumeric = 139


Const Adarray = & H2000





Dim rs, cmd, CN


Set cmd = Server.CreateObject ("Adodb.command")


Set cn = Server.CreateObject ("ADODB.") Connection ")


' Here is a SQL Server 2008 database, and other databases modify the connection string.


cn. Open "PROVIDER=SQLNCLI10; server= (local);D atabase= database name; uid= database login name; pwd= password; " 


with cmd


    . ActiveConnection = cn


    . CommandType = adCmdText


    . CommandText = "Select * from Baseobject Where parentname like?" and contentclass=? " 


    . Prepared = True


    . Parameters.Append. CreateParameter ("ParentName", Advarchar,adparaminput,
, "%/itemimage/%")

    . Parameters.Append. CreateParameter ("Mengxianhui", Advarchar,adparaminput,
, "urn:schemas-mengxianhui-com-cn:basedocument")

Set rs =. Execute


End With


while not Rs. EOF


Response.Write "<li>" & RS ("displayname")


Rs. MoveNext


Wend


Set cmd = Nothing


Set rs = Nothing


Set cn = Nothing


% >





can also write the following format:


Dim rs, cmd, CN


Set cmd = Server.CreateObject ("Adodb.command")


Set cn = Server.CreateObject ("ADODB.") Connection ")


' Here is a SQL Server 2008 database, and other databases modify the connection string.


cn. Open "PROVIDER=SQLNCLI10; server= (local);D atabase= database name; uid= database login name; pwd= password; " 


with cmd


    . ActiveConnection = cn


    . CommandType = adCmdText


    . CommandText = "Select * from Baseobject Where parentname like?" and contentclass=? " 


    . Prepared = True


    . Parameters (0). Value = "%/itemimage/%"


    . Parameters (1). Value = "Urn:schemas-mengxianhui-com-cn:basedocument"


Set rs =. Execute


End With


while not Rs. Eof


Response.Write "<li>" & RS ("displayname")


Rs. MoveNext


Wend

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.