| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 807 人关注过本帖
标题:求教一个ASP中事务的问题
只看楼主 加入收藏
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
 问题点数:0 回复次数:2 
求教一个ASP中事务的问题

我是初学者,这段代码原运行都没事,可是后来添加了connection的事务后,就出错了,看了好几遍也不知道错在哪,请高手指一二,先行谢过。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- #include file = "db.inc.asp" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<center>
<table width="400" height="691" border="0">
<tr>
<td align="center" valign="middle">
<%
set rst = Server.CreateObject("adodb.recordset")
rst.open "select * from user where u_user ='"&request.form("f_id")&"'", conn, 1, 1
if rst.recordcount>0 then
response.write("用户名已经存在,请重新填写")
rst.close
set rst = nothing
conn.close
set conn = nothing
response.end
else
conn.begintrans
rst.close
rst.open "user", conn, 1, 3
rst.addnew
rst("u_user") = request.form("f_id")
rst("u_code") = request.form("f_pas")
rst.update
rst.close
set rst1 = conn.Execute("select @@IDENTITY as uid")
uid = rst1("uid")
rst.open "info", conn, 1, 3
rst.addnew
rst("i_uid") = uid
rst("i_name") = request.form("f_name")
rst("i_sex") = request.form("f_sex")
rst("i_age") = request.form("f_age")
rst("i_vip") = false
rst.update
rst.close
if err.number<>0 then
conn.rollbacktrans
%>
<img src="img/zcsb.jpg" width="357" height="229" /><br />
<%
else
conn.committrans
%>
<img src="img/zccg.jpg" width="355" height="240" />
<%
end if
end if
%>
</td>
</tr>
</table>
<%
set rst = nothing
conn.close
set conn = nothing
%>
</center>
</body>
</html>

搜索更多相关主题的帖子: 事务 ASP DTD dtd 
2007-07-21 11:51
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
得分:0 

怎么发上去后连到一起了??
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- #include file = "db.inc.asp" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<center>
<table width="400" height="691" border="0">
<tr>
<td align="center" valign="middle">
<%
set rst = Server.CreateObject("adodb.recordset")
rst.open "select * from user where u_user ='"&request.form("f_id")&"'", conn, 1, 1
if rst.recordcount>0 then
response.write("用户名已经存在,请重新填写")
rst.close
set rst = nothing
conn.close
set conn = nothing
response.end
else
conn.begintrans
rst.close
rst.open "user", conn, 1, 3
rst.addnew
rst("u_user") = request.form("f_id")
rst("u_code") = request.form("f_pas")
rst.update
rst.close
set rst1 = conn.Execute("select @@IDENTITY as uid")
uid = rst1("uid")
rst.open "info", conn, 1, 3
rst.addnew
rst("i_uid") = uid
rst("i_name") = request.form("f_name")
rst("i_sex") = request.form("f_sex")
rst("i_age") = request.form("f_age")
rst("i_vip") = false
rst.update
rst.close
if err.number<>0 then
conn.rollbacktrans
%>
<img src="img/zcsb.jpg" width="357" height="229" /><br />
<%
else
conn.committrans
%>
<img src="img/zccg.jpg" width="355" height="240" />
<%
end if
end if
%>
</td>
</tr>
</table>
<%
set rst = nothing
conn.close
set conn = nothing
%>
</center>
</body>
</html>

2007-07-21 11:53
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
得分:0 
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]现在无法设置属性
/reg/result.asp, 第 26 行
2007-07-21 11:55
快速回复:求教一个ASP中事务的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032510 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved