我在写存储过程中遇到了一点困难,不知道如何解决,希望高人指点。结帖后马上加分。conn1.Execute "update CHAR_POWER set wLevel=1,wStr=1,wSus=1,wDex=1,dwExp=0,wRemainSp=(wRemainSp+1) * 100 where szNickName='" & char & "'" 上面这段是我写存储过程用到的语句,在结尾红色字体部分szNickName='" & char & "'"中的“szNickName”这个表和主表“CHAR_POWER”如何进行联合呢?
因为数据库结构比较复杂,人物属性和人物名称是分开的。所以存储过程这里我没搞懂,希望高人指点一下。谢谢了。
因为数据库结构比较复杂,人物属性和人物名称是分开的。所以存储过程这里我没搞懂,希望高人指点一下。谢谢了。
把用到的联表字段分析一下
发上来你写的是把 szNickName='&char&''
的数据全都更新le
set 更新字段 from t1 , t2
where 条件 这种方法我试过了,但是除了存储没执行以外其他显示都正确。
if request.QueryString("action") = "submit" then
conn.Open connstr
conn1.Open connstr1
char = request.Form("char")
id = request.Form("id")
pwd = request.Form("pwd")
if id= "" or instr(id,"'") or instr(id,"=") or instr(id,"%") then
response.write " <script> alert('游戏帐号为空或长度不正确!');history.back(-1) </script> "
response.end
end if
if pwd= "" or instr(pwd,"'") or instr(pwd,"=") or instr(pwd,"%") then
response.write " <script> alert('游戏密码为空或长度不正确!');history.back(-1) </script> "
response.end
end if
if char= "" or instr(char,"'") or instr(char,"=") or instr(char,"%") then
response.write " <script> alert('游戏角色为空或长度不正确!');history.back(-1) </script> "
response.end
end if
set rs = server.createobject("adodb.recordset")
rs.open "select * from Account where szAccount='" & id & "' and szPasswd='" & pwd & "'",conn,1,1
if rs.eof then
response.write " <script> alert('你输入的帐号或密码不正确!');history.back(-1) </script> "
response.end
end if
rs.close
rs.open "select * from CHAR_BASIC,CHAR_ACCOUNT where szNickName='" & char & "' and szAccount='" & id & "'",conn1,1,1
if rs.eof then
response.write " <script> alert('没有找到你所填写的角色!');history.back(-1) </script> "
response.end
end if
rs.close
rs.open "select * from CHAR_POWER,CHAR_ACCOUNT where wLevel> =99 and szAccount='" & id & "'",conn1,1,1
if rs.eof then
response.write " <script> alert('你的等级不到99!');history.back(-1) </script> "
response.end
end if conn1.Execute "update CHAR_POWER set wLevel=1,wStr=1,wSus=1,wDex=1,dwExp=0,wRemainSp=(wRemainSp+1) * 100 from CHAR_POWER,CHAR_BASIC where szNickName='" & char & "'"
response.write " <script> alert('恭喜!您的角色转生成功!快去游戏里看看吧!');history.back(-1) </script> "
response.end
end if
%> 具体结构是这样的。但是提示转生成功了,可是级别和赋予的属性都没变,就是显示成功了而已。
这里需要通过两个表来实现,指任的是人物属性表,和人物名称表。
set 更新字段 from t1 , t2
where 条件 这种方法我试过了,但是除了存储没执行以外其他显示都正确。 ConnStr = "Provider = Sqloledb; User ID
if request.QueryString("action") = "submit" then
conn.Open connstr
conn1.Open connstr1
char = request.Form("char")
id = request.Form("id")
pwd = request.Form("pwd")
if id= "" or instr(id,"'") or instr(id,"=") or instr(id,"%") then
response.write "<script>alert('游戏帐号为空或长度不正确!');history.back(-1)</script>"
response.end
end if
if pwd= "" or instr(pwd,"'") or instr(pwd,"=") or instr(pwd,"%") then
response.write "<script>alert('游戏密码为空或长度不正确!');history.back(-1)</script>"
response.end
end if
if char= "" or instr(char,"'") or instr(char,"=") or instr(char,"%") then
response.write "<script>alert('游戏角色为空或长度不正确!');history.back(-1)</script>"
response.end
end if
set rs = server.createobject("adodb.recordset")
rs.open "select * from Account where szAccount='" & id & "' and szPasswd='" & pwd & "'",conn,1,1
if rs.eof then
response.write "<script>alert('你输入的帐号或密码不正确!');history.back(-1)</script>"
response.end
end if
rs.close
rs.open "select * from CHAR_BASIC,CHAR_ACCOUNT where szNickName='" & char & "' and szAccount='" & id & "'",conn1,1,1
if rs.eof then
response.write "<script>alert('没有找到你所填写的角色!');history.back(-1)</script>"
response.end
end if
rs.close
rs.open "select * from CHAR_POWER,CHAR_ACCOUNT where wLevel>=99 and szAccount='" & id & "'",conn1,1,1
if rs.eof then
response.write "<script>alert('你的等级不到99!');history.back(-1)</script>"
response.end
end if conn1.Execute "update CHAR_POWER set wLevel=1,wStr=1,wSus=1,wDex=1,dwExp=0,wRemainSp=(wRemainSp+1) * 100 from CHAR_POWER,CHAR_BASIC where szNickName='" & char & "'"
response.write "<script>alert('恭喜!您的角色转生成功!快去游戏里看看吧!');history.back(-1)</script>"
response.end
end if
%>
具体结构是这样的。但是提示转生成功了,可是级别和赋予的属性都没变,就是显示成功了而已。
这里需要通过两个表来实现,指任的是人物属性表,和人物名称表。