asp 同时更新2个表
一表字段:credit2二表字段:sh请问修改时怎样同时可以更新两个表数据代码如下<%Setrs=Server.CreateObject("ADODB.Recordset...
一表字段:credit2
二表字段:sh
请问修改时怎样同时可以更新两个表数据
代码如下
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select a.cart,a.uid,a.datetime,c.uniacid,a.sh,a.sh,b.nickname,b.mobile,b.uid,c.uid,(c.credit2+400) as dasd from mc_paidui a,ims_ewei_shop_member b, ims_mc_members c where b.uid=a.uid and a.uid=c.uid and c.uniacid='3' and a.sh='0' order by a.datetime desc "
rs.open sql,conn,1,3
if rs.eof or rs.bof then
response.write "对不起,您暂时没有信息!"
response.end
end if
%>
<tr>
<td width="13%" style="background-color: #ff0000; color: #ffffff">兑换的乐币</td>
<td width="21%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">申请人</td>
<td width="42%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">联系电话</td>
<td width="14%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">申请时间</td>
<td width="10%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">操作</td>
</tr>
<%do while not rs.eof%>
<form action="dh_sv.asp?action=paidui" method="post" name="form1" id="form1" onSubmit="return Validator.Validate(this,2)">
<tr>
<td width="13%" style="background-color: #ff0000; color: #ffffff"><%if rs("cart")>400 then%>违规操作,注意行为!
<%else%><%=rs("cart")%> <%=rs("dasd")%>
<input name="credit2" type="hidden" id="credit2" value="<%=rs("dasd")%>" style="display: none;">
<input name="sh" type="hidden" id="credit2" value="<%=rs("sh")%>" style="display: none;">
<input name="uid" type="hidden" id="uid" value="<%=rs("uid")%>">
<%end if%>
</td>
<td width="21%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"><%=rs("nickname")%></td>
<td width="42%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"><%=rs("mobile")%></td>
<td width="14%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"><%=rs("datetime")%></td>
<td width="10%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"> <input type="submit" name="button" id="button" value="确认" /> </td>
</tr>
</form>
<%
rs.movenext
loop
rs.close
%>
这是单独更新一个表的
<% if request.querystring("action")="paidui" then
set rs=server.createobject("adodb.recordset")
sql="select * from ims_mc_members where uid="&request.form("uid")&" "
rs.open sql,conn,1,3
rs("credit2")=trim(request.form("credit2"))
rs.update
response.Write "<script language=javascript>alert('排队成功!');window.location.href='"&request.serverVariables("HTTP_REFERER")&"';</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%> 展开
二表字段:sh
请问修改时怎样同时可以更新两个表数据
代码如下
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select a.cart,a.uid,a.datetime,c.uniacid,a.sh,a.sh,b.nickname,b.mobile,b.uid,c.uid,(c.credit2+400) as dasd from mc_paidui a,ims_ewei_shop_member b, ims_mc_members c where b.uid=a.uid and a.uid=c.uid and c.uniacid='3' and a.sh='0' order by a.datetime desc "
rs.open sql,conn,1,3
if rs.eof or rs.bof then
response.write "对不起,您暂时没有信息!"
response.end
end if
%>
<tr>
<td width="13%" style="background-color: #ff0000; color: #ffffff">兑换的乐币</td>
<td width="21%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">申请人</td>
<td width="42%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">联系电话</td>
<td width="14%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">申请时间</td>
<td width="10%" style="background-color: #ff0000; color: #ffffff; text-align:right;padding-right:10px;">操作</td>
</tr>
<%do while not rs.eof%>
<form action="dh_sv.asp?action=paidui" method="post" name="form1" id="form1" onSubmit="return Validator.Validate(this,2)">
<tr>
<td width="13%" style="background-color: #ff0000; color: #ffffff"><%if rs("cart")>400 then%>违规操作,注意行为!
<%else%><%=rs("cart")%> <%=rs("dasd")%>
<input name="credit2" type="hidden" id="credit2" value="<%=rs("dasd")%>" style="display: none;">
<input name="sh" type="hidden" id="credit2" value="<%=rs("sh")%>" style="display: none;">
<input name="uid" type="hidden" id="uid" value="<%=rs("uid")%>">
<%end if%>
</td>
<td width="21%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"><%=rs("nickname")%></td>
<td width="42%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"><%=rs("mobile")%></td>
<td width="14%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"><%=rs("datetime")%></td>
<td width="10%" style="background-color: #ff0000; color: #ffffff;text-align:right; padding-right:10px;"> <input type="submit" name="button" id="button" value="确认" /> </td>
</tr>
</form>
<%
rs.movenext
loop
rs.close
%>
这是单独更新一个表的
<% if request.querystring("action")="paidui" then
set rs=server.createobject("adodb.recordset")
sql="select * from ims_mc_members where uid="&request.form("uid")&" "
rs.open sql,conn,1,3
rs("credit2")=trim(request.form("credit2"))
rs.update
response.Write "<script language=javascript>alert('排队成功!');window.location.href='"&request.serverVariables("HTTP_REFERER")&"';</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%> 展开
2017-08-14
展开全部
这个假设EXCEL为数据库不就行了么?利用UPDATE组件将EXCEL上传到服务器,DimConn,Driver,DBPath,Rs'建立Connection对象SetConn=Server.CreateObject("ADODB.Connection")Driver="Driver={MicrosoftExcelDriver(*.xls)};"DBPath="DBQ="&Server.MapPath("test.xls")'调用Open方法打开数据库Conn.OpenDriver&DBPath和操作数据库一样读取EXCEL,将数据读到网页!这只是一种思路,还有交互的方式
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询