(ADODB.Command)對象的用法,用CASE調用的REM/DEL/UPDATE/

來源:互聯網
上載者:User
ado|command|對象|ado <!--#include file="conn.asp"-->
<%set rs=server.createobject("adodb.recordset")
sql="select * from jtopic order by j_id desc"
rs.open sql,conn,1,1
%>
<script language="javascript">
function check1(i,o)
{
document.form.text2.value=i;
document.form.word2.value=o;
}
</script>

<form name="form" method="post" action="sort_in.asp">
<br><b> 專題類別:</b>
<input type="hidden" name="options" value=''>
 <select name="jtop" id="jtop" onchange="check1(document.form.jtop.options[document.form.jtop.selectedIndex].lable,document.form.jtop.options[document.form.jtop.selectedIndex].title)">
<% do while not rs.eof %>
<option value="<%=rs("j_id")%>" lable="<%=rs("j_name")%>" title="<% =rs("j_flag") %>"><%=rs("j_name")%></option>
<%
rs.movenext
loop
%></select>
<input type="submit" name="Submit" value="刪 除" onclick="form.options.value='del'"><p>
 <input type="text" name="word1" size=57 value="" maxlength="50" style="width: 369; height: 22"> 
<input name="tui1" type="radio" id="tui" value="0" checked>預設<font color=red><b>0</b></font>
<input name="tui1" type="radio" id="tui" value="1">推薦<font color=red><b>1</b></font>
<input type="submit" name="Submit1" value="添 加" onclick="form.options.value='new'"> </p><p>
 <input type="text" name="text2" size=57 value="" maxlength="50" style="width: 370; height: 22">
<input type="text" name="word2" size=57 value="" maxlength="50" style="width: 70; height: 23"> 
<input type="submit" name="Submit2" value="修 改" onclick="form.options.value='rename'">  </p>
</form> 

+++++++++++ sort_in.asp +++++++++++++++++++++++++++++++++++
<!--#include file="conn.asp"-->
<%
dim cmdTemp

select case request.form("options")
case "rename"
on error resume next
Set cmdTemp = Server.CreateObject("ADODB.Command")
set rs=server.createobject("adodb.recordset")
cmdTemp.CommandText = "SELECT * FROM jtopic where j_id=" & request.form("jtop")
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
rs.Open cmdTemp, , 1, 3
if err.Number<>0 then
err.clear
response.write " <br>數 據 庫 操 作 失 敗 ! "
else
rs("j_name") = request.form("text2")
rs("j_flag") = request.form("word2")
rs.Update
rs.Close
set rs=nothing
set cmdTemp=nothing
finished
end if
case "del"
Rem 刪除欄目 /. 注釋或標記語句:Rem 格式:Rem [注釋或標記](解釋:可以當作標記供跳躍陳述式使用,也可以當作指令碼

[1] [2] 下一頁  



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。