如何使用sql语句来修改数据记录(2)
来源:CSDN 发布时间:2007-06-21 11:48:00
标签:sql,修改记录,update
2,change.asp
<!--#include file="conn.asp" -->
<%
id=request.querystring("id")
%>
<%if request.form("submit")="change" then
whattitle=request.form("title")
whoauthor=request.form("author")
whatcontent=request.form("content")
id=request.form("id")
Set rs = Server.CreateObject ("ADODB.Recordset")
sql = "Select * from cnarticle where cn_id="&id
rs.Open sql,conn,3,2
rs("cn_title")=whattitle
rs("cn_author")=whoauthor
rs("cn_content")=whatcontent
rs.update
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
response.redirect("showit.asp")
response.end
%>
<%end if%>
<%
if id<>"" then
Set rs = Server.CreateObject ("ADODB.Recordset")
sql="select * from cnarticle where cn_id="&id
rs.Open sql,conn,1,1
whattitle=rs("cn_title")
whoauthor=rs("cn_author")
whatcontent=rs("cn_content")
end if
%>
<form action="change.asp" method="post">
Title:<input type="text" name="title" value=<%=whattitle%>><br>
Author:<input type="text" name="author" value=<%=whoauthor%>><br>
Content:<br>
<textarea name="content" rows="8" cols="30"><%=whatcontent%></textarea><br>
<input type="submit" value="change" name="submit">
<input type="reset" value="Reset">
<input name="id" type="hidden" value="<%=id%>">
</form>
当然所有的检察,安全防护都还没做,BUG多多,自己也来慢慢解决。
另外一类的修改更新使用conn.Execute(sql),
<%if request.form("submit")="change" then
whattitle=request.form("title")
whoauthor=request.form("author")
whatcontent=request.form("content")
id=request.form("id")
sql = "update cnarticle set cn_title=’"&whattitle&"’,cn_author=’"&whoauthor&"’,cn_content=’"&whatcontent&"’ where cn_id="&id
conn.Execute(sql)
conn.close
set conn=Nothing
response.redirect("showit.asp")
response.end
%>


猜你喜欢
- 一、Background当想将照片序列合成延时摄影视频时,可能会发现照片中缺少一张,或者照片序列是跨时间、并不连续的,如图1所示,但PR中只
- 本文实例讲述了Python实现的径向基(RBF)神经网络。分享给大家供大家参考,具体如下:from numpy import array,
- JavaScript toLowerCase 方法toLowerCase 方法用于把(英文)字符串转换为小写,并返回转换后的字符串。其语法如
- 打开要设置的数据库表,点击要设置的字段,比如id,这时下方会出现id的列属性表列属性中,通过设置“标识规范”的属性可以设置字段自增,从下图上
- 0.引言利用Dlib官方训练好的模型“shape_predictor_68_face_landmarks.dat”进行68点标定,利用Ope
- 如下所示,代码为:array也可直接使用上面代码。测试如下:来源:https://blog.csdn.net/u011624019/arti
- requests上传excel数据流headers=self.headers #获取导
- 最近邻法和k-近邻法下面图片中只有三种豆,有三个豆是未知的种类,如何判定他们的种类?提供一种思路,即:未知的豆离哪种豆最近就认为未知豆和该豆
- 我们平时接触的长乘法,按位相乘,是一种时间复杂度为 O(n ^ 2) 的算法。今天,我们来介绍一种时间复杂度为 O (n ^ log 3)
- 摘录 – Parse JavaScript SDK现在提供了支持大多数异步方法的兼容jquery的Promises模式,那么这意味着什么呢,
- 本文实例为大家分享了vuex实现购物车功能的具体代码,供大家参考,具体内容如下页面布局:采用了element-ui的表格对商品列表和购物车列
- 一.Jupyter介绍Jupyter Notebook是一个交互式笔记本,支持运行40多种编程语言。Jupyter Notebook 的本质
- 地图 API Map() 构造器实例创建一个 Google 地图:<html><head><scriptsrc
- 本文介绍了SpringBoot 中使用JSP的方法示例,分享给大家,具体如下:依赖: <parent>
- pycharm创建新文件自动添加文件头注释背景我们平时在使用pycharm发现有些大神创建一个新文件的时候会自动在文件头添加一些注释,像是有
- 1,创建测试表CREATE TABLE `testsign` ( `userid` int(5) DEFAULT NULL, `user
- 查询一天:select * from table where to_days(column_time) = to_days(now());s
- 尽管某些书籍上总是说避免使用全局变量,但是在实际的需求不断变化中,往往定义一个全局变量是最可靠的方法,但是又必须要避免变量名覆盖。Pytho
- 一、算法简要我们希望有这么一种函数:接受输入然后预测出类别,这样用于分类。这里,用到了数学中的sigmoid函数,sigmoid函数的具体表
- 本文实例为大家分享了python+pygame实现坦克大战的具体代码,供大家参考,具体内容如下一、首先导入pygame库二、源码分享#cod