100分求asp+Access 在页面上解修改、删除数据的代码例子。。。

yaoge 2005-04-09 11:07:00
100分求asp+Access 在页面上解修改、删除数据的代码例子。。。

急。。。
...全文
170 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
longsnow 2005-04-09
  • 打赏
  • 举报
回复
估计随便搜什么代码都有
themedy 2005-04-09
  • 打赏
  • 举报
回复
不好意思,打错了。修改是:

修改:update 数据表 set 字段名=新的值 where id=你要修改的id
themedy 2005-04-09
  • 打赏
  • 举报
回复
是修改删除数据库中的资料吗?假设每条记录都有唯一的id值对于,那么
修改:update 数据表 set 字段名 where id=你要修改的id
删除:delete from 表名 where id=你要修改的id

接分啊……

itzhiren 2005-04-09
  • 打赏
  • 举报
回复
对呀,网上一搜很多的
libaisongtuye 2005-04-09
  • 打赏
  • 举报
回复
admin_news_list.asp
<!--#include file=conn.asp-->
<!--#include file=cook.asp-->
<!--#include file=../inc/function.asp-->
<!--#include file=../inc/top.asp-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="../inc/css.css" rel="stylesheet" type="text/css">
</head>

<body>

<%
CurrentPage = request("Page")
set rs=server.createobject("adodb.recordset")
sqltext="select * from dtxw order by id desc "
rs.open sqltext,conn,1,1
MaxPerPage=5
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
If Rs.recordcount > MaxPerPage then
end if
%>
<%
if not rs.eof then
i=0
do while not rs.eof
%>
<table width="90%" border="1" align="center" cellpadding="4" cellspacing="0">
<tr>
<td width="107" rowspan="2">
<%
if rs("imgname")="" then
response.Write("<font color='#ff0000'>暂无图片</font>")
else
%>
<img src="newimg/<%=rs("imgname")%>" width="100" height="80">
<% end if%>
</td>
<td width="451">标题名称:<%= rs("name") %></td>
<td width="35"><a href="admin_news_save.asp?action=del&id=<%=rs("id")%>">删除</a></td>
</tr>
<tr>
<td style="center: 0px; WIDTH: 550; WORD-WRAP: break-word">详细介绍:<%=htmlencode(rs("text"))%></td>
<td valign="top"><a href="admin_news_edit.asp?id=<%=rs("id")%>">修改</a></td>
</tr>
</table><br>
<%
rs.MoveNext
i=i+1
if i>=MaxPerPage then exit do
loop
end if
%>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td><%
Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条信息</font></strong>          "
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong> "
If currentpage > 1 Then
response.write "<strong><a href='admin_news_list.asp?&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='admin_news_list.asp?page="+Cstr(currentpage-1)+"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < Rs.PageCount Then
Response.write "<strong><a href='admin_news_list.asp?page="+Cstr(currentPage+1)+"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='admin_news_list.asp?page="+Cstr(Rs.PageCount)+"'><font color='#000000'>尾页</font></a></strong>  "
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong>  "
End if
%></td>
</tr>
</table>
<!--#include file=../inc/foot.asp-->
</body>
</html>
libaisongtuye 2005-04-09
  • 打赏
  • 举报
回复
admin_news_save.asp
<!--#include file="conn.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim action,id
id=replace(request("id"),"'","")
action=request("action")
select case action
case "add"
set rs=server.CreateObject("adodb.recordset")
sql="select * from dtxw where id is null"
rs.open sql,conn,1,3
rs.addnew
rs("name")=trim(request("name"))
rs("author")=trim(request("author"))
rs("text")=request("text")
rs("imgname")=request("imgname")
rs("updatetime")=now()
rs.update
rs.close
set rs=nothing
%>
<script language="JavaScript">
alert("动态新闻发布成功");
location.href="admin_news_list.asp";
</script>

<%
case "edit"
set rs=server.CreateObject("adodb.recordset")
sql="select * from dtxw where id ="&id
rs.open sql,conn,1,3
rs("name")=trim(request("name"))
rs("author")=trim(request("author"))
rs("text")=request("text")
rs("imgname")=request("imgname")
rs("updatetime")=now()
rs.update
rs.close
set rs=nothing
%>
<script language="JavaScript">
alert("动态新闻修改成功");
location.href="admin_news_list.asp";
</script>

<%
case "del"
if id="" then
response.Redirect "admin_news_list.asp"
end if
if not isnumeric(id) then
response.Redirect "admin_news_list.asp"
end if

sql="select imgname from dtxw where id="&id
set rs=conn.execute(sql)
dim imgname
imgname=rs("imgname")
rs.close
set rs=nothing

set fs=server.CreateObject("scripting.filesystemobject")
path=server.MapPath("newimg")&"/"&imgname
if fs.fileExIsTs(path) then
fs.deletefile(path)
end if
sql="delete from dtxw where id="&id
conn.execute(sql)
%>
<script language="JavaScript">
alert("动态新闻已经删除");
location.href="admin_news_list.asp";
</script>
<%
end select
%>
libaisongtuye 2005-04-09
  • 打赏
  • 举报
回复
呵呵,俺来接分,下面的是我用的新闻发布的系统,表名字段什么的做出相应改动即可
admin_news_add.asp

<!--#include file=cook.asp-->
<!--#include file=../inc/top.asp-->
<%
if session("flag")<>0 then
response.Write("您没有操作权限")
response.End()
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="../inc/css.css" rel="stylesheet" type="text/css"></head>
<body>
<table width="80%" border="1" align="center" cellpadding="5" cellspacing="0">
<form name="myform" method="post" action="admin_news_save.asp?action=add">
<tr>
<td colspan="2"><strong>添加动态新闻</strong> </td>
</tr>
<tr>
<td width="32%" align="right">标题:</td>
<td width="68%" ><input name="name" type="text" id="name">
<font color="#FF0000">*</font> </td>
</tr>

<tr>
<td align="right">详细介绍:</td>
<td><textarea name="text" cols="50" rows="10" id="text"></textarea>
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td align="right">图片介绍:</td>
<td><input name="ImgName" type="text" id="ImgName" size="26">
<input type="button" name="Submit3" value="上传" onClick="javascript: window.open('upfile.htm','','left=100,top=100,width=300,height=200,scrollbars=1');">
至多50K </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="确 定">
<input type="reset" name="Submit2" value="取 消"></td>
</tr>
</form>
</table>
<!--#include file=../inc/foot.asp-->
</body>
</html>
coolwindkaka 2005-04-09
  • 打赏
  • 举报
回复
晕。。。也太简单了吧,你找个最最小的留言本什么的看下就行了
myvicy 2005-04-09
  • 打赏
  • 举报
回复
随便搜索留言本,之类的下载一个就可以
richwong 2005-04-09
  • 打赏
  • 举报
回复
google上n多。。浪费
yaoge 2005-04-09
  • 打赏
  • 举报
回复
邮箱:gllgle@tom.com
yb2008 2005-04-09
  • 打赏
  • 举报
回复
修改核心代码:
<%
set rs=Server.CreateObject("Adodb.Recordset")
sqlstr="select * from SupplierGoodsData where id="&id
rs.open sqlstr,conn,1,3
if rs.eof=true then Response.Write("ProvideGoodsModify.asp")
rs("SupplierID")=request("SupplierID") '供应商ID
rs("CompanyName")=request("CompanyName") '公司名称
rs("GoodsClass")=request("GoodsClass") '商品分类
rs("GoodsName")=request("GoodsName") '商品名称
rs("Brand")=request("Brand") '品牌
rs("Specification")=request("Specification") '规格
rs("PracticePrint")=request("PracticePrint") '适用机型
rs("CleanPrice")=request("CleanPrice") '净货价
rs("CostPrice")=request("CostPrice") '成本价
rs("Remarks")=request("Remarks") '备注

rs.update
%>
yb2008 2005-04-09
  • 打赏
  • 举报
回复
删除核心代码:

set rs=Server.CreateObject("Adodb.Recordset")
sqlstr="select * from Print where id="&id
rs.open sqlstr,conn,1,3
lovebanyi 2005-04-09
  • 打赏
  • 举报
回复
dvbbs吧..去研究一下.学透了..功力会上升一个非常大的台阶..可惜asp.net至今没有找到什么好的.

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧