数据库连接 <% dim db,conn,myconn db="/database/product.mdb" Set Conn = Server.CreateObject("ADODB.Connection") myconn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"") Conn.Open MyConn %> '添加数据
<% name=request.form("name") type_=request.form("type_") about=ubbcode(request.form("about")) pic=request.form("PIC") if name="" or pic="" or type_="" then response.write"错误!内容必须添写!或您没有选择类别" else set sql=conn.execute("Insert Into RY_WH(title,about,pic,type_,time_) Values ('"&name&"','"&about&"','"&pic&"','"&type_&"','"&date()&"')") set sql=nothing response.redirect("q_admin.asp") end if %>
'删除数据
<% id=Request.QueryString("id") Set book=server.createobject("adodb.recordset") SQLstr="Delete * from RY_WH where id = " & id conn.Execute SQLstr set book=nothing conn.close set conn=nothing response.redirect("Q_admin.asp") %>
数据修改! <% set rs=server.createobject("adodb.recordset") id=request.form("type") typename_=request.form("typename") sql=("select * from RY_WH_TYPE where id="&id&"") rs.open sql,conn,1,3 rs("typename")=typename_ rs.update rs.close response.redirect("Q_type.asp") %>