您好,欢迎来好库! [ 请登录 ] [ 免费注册 ] 好库网首页 | 我的好库
好库网 好库网社区
IT社区 » WEB开发与应用 » ASP » ASP中Command对象的使用例子
回复 发帖
haobao 发表于 2011-4-18 12:08:15
1楼
ASP中Command对象的使用例子

主要是Command对象以及CreateParameter方法、配合Recordset、AppendChunk方法的使用。

 

Set Cmd = Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandType = 1
Cmd.CommandText = "DELETE FROM shop WHERE brandname = ? AND nickname = ?"
Cmd.Parameters.Append(Cmd.CreateParameter("brandname", 200, 1, 30, brandname))
Cmd.Parameters.Append(Cmd.CreateParameter("nickname", 200, 1, 30, nickname))
Cmd.Execute
Set Cmd = nothing

'----------------------------------------------


Set Cmd = Server.CreateObject("ADODB.Command")
Set RS = Server.CreateObject("ADODB.Recordset")

' 品牌信息
Cmd.ActiveConnection = Conn
Cmd.CommandType = 1
Cmd.CommandText = "SELECT * FROM brand WHERE brandname = ?"
Cmd.Parameters.Append(Cmd.CreateParameter("brandname", 200, 1, 30, brandname))

RS.CursorType = 1
RS.LockType = 3
RS.Open(Cmd)

RS("catid") = catid
RS("cname") = cname
RS("official") = official
RS("logo") = logo
RS("otherurl").AppendChunk(otherurl)
RS("intro").AppendChunk(intro)

RS.Update
RS.Close
Set RS = nothing
Set Cmd = nothing

 

 

回复 发帖