Rss & SiteMap

康柏仕电脑学院 index.asp

康柏仕电脑学院--台湾正航ERP软件售后技术论坛,客服热线0769-81158210
共1 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:怎样用ASP连接数据库

1楼
superpch 发表于:2007/4/18 12:47:00
数据库连接
<%
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")
%>

共1 条记录, 每页显示 10 条, 页签: [1]

Copyright ©2005 - 2024 康柏仕电脑学院 清理缓存

正航ERP软件-企业ERP最佳选择! http://www.chidg.com  0769-81158210
Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.