<%
' ************ 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