asp操作数据库代码

<%

db="/book.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr

Set rs=Server.CreateObject("ADODB.Recordset")
sql="Select * from ebook "
rs.open sql,conn,1,1
if not rs.eof then
%>
 
<% do while not rs.eof %>
name:<%=rs("name")%>Time:<%=rs("time")%><br>
<%
rs.movenext
loop
rs.close
Set rs=nothing
end if
%>


Set rsw=Server.Createobject("ADODB.Recordset")
rs.open "Select * from ebook",conn,1,3
rs.addnew
rs("title")=uname
rs("qq")=qq
rs.update
rs.close
set rs=nothing

你可能感兴趣的:(asp)