asp添加数据记录写入,删除,查看实列

<!--#include file="conn.asp"-->
<%
if request.Form("username")="" or request.form("password")="" then
response.Write("<script>alert('您好,不能为空 ');location.href='index.html';</script>")
end if
%>
<%
dim rs,sql,lyq,ekaida
lyq=request.form("username")
ekaida=request.form("password")
sql="select * from admin"
set rs=server.createobject("adodb.recordset")
rs.open sql,db,1,3
rs.addnew
rs("username")=lyq
rs("password")=ekaida
rs.update
rs.close
set rs=nothing
response.Write("<script>alert('您好,数据库写入成功,正在转入首页 ');location.href='index.html';</script>")
%>
---------------------------------------------------------------------------------------------------
<!--#include file="conn.asp"-->
<%
username=request.form("delnet")
if request.Form("delnet")="" then
response.Write("<script>alert('您好,请输入删除的用户名然后点击提 交!');location.href='index.html';</script>")
end if
%>
<%
set rs=server.createobject("adodb.recordset")
sql="delete * from admin where username='"&trim(request.form("delnet"))&"'"
rs.open sql,db,3,2
db.close
set db=nothing
%>
<%
response.Write("<script>alert('用户:"&username&"删除成功 ');location.href='index.html';</script>")

%>
-------------------------------------------------------------------------------
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from admin order by id desc"
rs.open sql,db,1,1
%>
<%
do while not rs.eof
%>
<%=rs("username")%>
<%=rs("password")%>
<%
rs.movenext
loop
%>
-------------------------------------------------------------------------------
conn
--------------------------------
<%
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("data.mdb")
set db= Server.CreateObject("ADODB.Connection")
db.open connstr
%>
-------------------------------------------------------------------------------- 会员登陆代码
<%@ language="vbscript"%>
<%response.Expires = 0%>
<!--#include file="conn.asp"-->
<%
dim uid ,pwd
uid=request.Form("username")
pwd=request.Form("password")
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from user where password='"&pwd&"'"
rs.open sql,conn,1,1
if pwd<>RS("password") then
response.Write("<script>alert('您好,您的用户名或密码错误')</script>")
response.End()
else
         session("test")="test"
         response.redirect "http://www.zh365.com/ "
end if
rs.close
set rs=nothing
%>

阅读更多
个人分类: ASP编程
想对作者说点什么? 我来说一句

asp.net动态添加数据库列

2010年05月14日 1.6MB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭