高分求解小问题(在线等)

splendor66 2005-12-17 06:29:47
目标:利用ASP实现数据库记录修改
代码1:<%
db_path= "test.mdb"
Set conn= Server.CreateObject("ADODB.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db_path)
conn.Open connstr
exec="select * from test where id="&request.querystring("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn
%>
<form name="form1" method="post" action="xiugai2.asp">
<table width="748" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>aa</td>
<td>bb</td>
</tr>
<tr>
<td>
<input type="text" name="aa" value="<%=rs("aa")%>">
</td>
<td>
<input type="text" name="bb" value="<%=rs("bb")%>">
<input type="submit" name="Submit" value="提交">
<input type="hidden" name="id" value="<%=request.querystring("id")%>">
</td>
</tr>
</table>
</form>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
代码2:<%
db_path= "test.mdb"
Set conn= Server.CreateObject("ADODB.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db_path)
conn.Open connstr
exec="select * from test where id="&request.form("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
rs("aa")=request.form("aa")
rs("bb")=request.form("bb")
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
前面代码用来修改记录,后面代码用来传递变量,做了一个隐藏表单!
请哪位高手能够及时解决一定高分相送……
谢谢各位啦……
完成这个,我就能够完成数据库的插入,删除,修改的整个更新过程了,希望能够尽快解决,我也能够尽快将这段学习告一段落!
...全文
116 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
splendor66 2005-12-17
  • 打赏
  • 举报
回复
querystring 是一个集合 好像是request对象的
splendor66 2005-12-17
  • 打赏
  • 举报
回复
这两个都改正了之后,还是不可以啊
querystring是asp的recordset对象的一个方法
返回记录集的
snyl 2005-12-17
  • 打赏
  • 举报
回复
request.querystring("id")

这句话里的querystring是什么?
snyl 2005-12-17
  • 打赏
  • 举报
回复

rs.open exec,conn

这句话应该改成这个吧
rs.open.exe,conn,1,1的吧最后一行
dcyuan480 2005-12-17
  • 打赏
  • 举报
回复
楼主要解决什么问题啊?你自己的代码不对吗?
splendor66 2005-12-17
  • 打赏
  • 举报
回复
有人帮忙不?
splendor66 2005-12-17
  • 打赏
  • 举报
回复
你的INCLUDE文件,我这里没有啊?
那是个什么文件啊?
有没有别的方法呢?
citytiti 2005-12-17
  • 打赏
  • 举报
回复
<!-- #include file = "../Connections/news.asp" -->
<%
type_name = Request.Form("type")
title = Request.Form("title")
content = Request.Form("content")
Dim objRS
Set objRS = GetRecordset("../db/news.mdb","news")
objRS.Addnew
objRS("type_name") = type_name
objRS("title") = title
objRS("content") = content
objRS.Update
objRS.Close
Set objRS = Nothing
MM_news_STRING.Close
Set MM_news_STRING = Nothing
%>

参照着改一下就能用了!这是个接收和写入的例子。
splendor66 2005-12-17
  • 打赏
  • 举报
回复
兄长们,能不能进来给小弟解决一下下啊?
谢谢谢谢!

28,391

社区成员

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

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