| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 619 人关注过本帖
标题:[求助 ASP]有两个数据库,把数据库B的列出的值等于数据库A的某个值
取消只看楼主 加入收藏
calnlao
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-4-3
结帖率:100%
收藏
 问题点数:0 回复次数:3 
[求助 ASP]有两个数据库,把数据库B的列出的值等于数据库A的某个值
[求助 ASP]有两个数据库,把数据库B的列出的值等于数据库A的某个值


数据库:B        表:user_chare

序列号 所属帐号  用户
 001   0000000  adasas

数据库:B  表:user_chare  所属帐号 等于 数据库:A   表:user_name 的  帐号

该怎么实现呢?我想用ASP程序实现它

小弟感谢~~~~

PS:这是一个游戏数据库。


[ 本帖最后由 calnlao 于 2010-4-4 17:47 编辑 ]
搜索更多相关主题的帖子: 数据库 ASP 
2010-04-04 17:40
calnlao
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-4-3
收藏
得分:0 
谢谢你
这问题困扰了我很多天了
查资料也没成功
我现在正在修改中
在此感谢你
2010-04-05 17:54
calnlao
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-4-3
收藏
得分:0 
现在我想做个分页,但是却不会执行每页的指定数
程序代码:
<%@language=vbscript codepage=936 %>
<!--#include file="../include/nAdminCheck.asp"-->
<%ConnPath="../../"%>
<!--#include file="../include/youxiconn.asp"-->
<!--#include file="../include/function.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../include/sys.css" rel="stylesheet" type="text/css">
<head>
<title>信息管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../include/pageturn.js"></script>
</head>
<body>
<div align="center" class="title"><b><font color="#FFFFFF"><br>

 用户信息管理</font></b></div>
  <br> 
  <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="2">
      <tr>
      <td height="20" align="center" bgcolor="f2f2f2">
      <table border="0" cellspacing="0" cellpadding="0">
    <form name="form1" method="get" action="userjiaose.asp">
    <tr>
    <td width="72" align="right">角色名:</td>
    <td width="131" >
    <input name="keyword" type="text" class="textinput" id="keyword" value="<%=keyword%>" size="20">
    </td>
    <td width="155" align="center">输入角色名字进行搜索</td>
    <td width="50">
    <input type="submit" name="Submit" value="检索">
    </td>
    <td width="310">&nbsp;</td>
    <td width="198">&nbsp;</td>
    </tr>
    </form>
    </table>
      </td>
    </tr>
      </table>
  <br>
<div align="center">
<%
      keyword=request("keyword")
      set rs=server.createobject("adodb.recordset")
sql="select user_no,character_no,character_name,wLevel,logout_time,dwMoney from [user_character] where 1=1"
    if request("keyword")<>"" then
    sql=sql&" and character_name like '%"&keyword&"%'"
    end if
   sql=sql&" order by user_no asc"
    rs.open sql,conn2,1,1
    rs.PageSize=20
  IF rs.Eof THEN
   Response.Write("<div align=center><font><H2>数据库里没有对应的数据存在!</font></div>")
   ELSE
%>
<form name="del" method="Post" action="delejiaose.asp" onSubmit="return ConfirmDel();">
  <table width="100%" border="0" cellpadding="5" cellspacing="1"  class="TABLEresult" align="center">
  <tr class="head">
    <td height="25" align="center" background="../include/sys.gif">&nbsp;</td>
    <td height="25" align="center" background="../include/sys.gif"><b>序列号</b></td>
    <td width="15%" align="center" background="../include/sys.gif"><b>所属帐号</b></td>
    <td width="17%" align="center" background="../include/sys.gif"><b>用户角色</b></td>
    <td width="6%" align="center" background="../include/sys.gif"><b>等级</b></td>
    <td width="18%" align="center" background="../include/sys.gif"><b>下线时间</b></td>
    <td width="11%" align="center" background="../include/sys.gif"><b>身上金钱</b></td>
    <td width="10%" align="center" background="../include/sys.gif"><b>操 作</b></td>
  </tr>
<%
    If Request("mypage")="" Then
       rs.absolutepage = 1
       inAbsolutePage=1
    Else
         rs.AbsolutePage = cint(Request("mypage"))
       inAbsolutePage=cint(Request("mypage"))
    End If
    For i=1 to rs.PageSize 
    do while not rs.eof   '循环开始
    dim A_name
    A_name=rs("user_no")
    dim rs1
    set rs1=conn3.execute ("select * from user_profile where user_no='"&A_name&"'") '用A的账号作为查询条件在B表里查询;
    do while not rs1.eof   '如果B表有多个账号对应,则再执行循环查询;
    dim B_name
    B_name=rs1("user_id")
%> 
    <tr class='Tr' onMouseOver="this.style.backgroundColor='#C6EBDE'" onMouseOut ="this.style.backgroundColor=''">
    <td width="4%" align='center' bgcolor="#E2EEFE"><p><br>
    </p></td>
        <td width="19%" align='center' bgcolor="#E2EEFE"><%=rs("character_no")%></td>
        <td align='center'  bgcolor="#E2EEFE"><%=B_name%></td>
        <td align='center'  bgcolor="#E2EEFE"><%=rs("character_name")%></td>
        <td align='center'  bgcolor="#E2EEFE"><%=rs("wLevel")%></td>
        <td align='center'  bgcolor="#E2EEFE"><%=rs("logout_time")%></td>
        <td align='center'  bgcolor="#E2EEFE"><%=rs("dwMoney")%></td>
        <td align='center' bgcolor="#E2EEFE"><a href="modifjiaose.asp?character_no=<%=rs("character_no")%>&character_name=<%=rs("character_name")%>">修改</a><a href="delejiaose.asp?character_no=<%=rs("character_no")%>" onClick="return confirm('您确定进行删除操作吗?')"> 删除</a></td>
    </tr>
<%
    rs1.movenext
  loop
   rs.movenext
  loop
   if rs.EOF then exit for
Next
%>
</table> </form>
<%
    mypage()
    rs.close
  set rs1=nothing
  set rs=nothing
END IF
%>
</div>
</body>
</html>


 
2010-04-05 20:04
calnlao
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-4-3
收藏
得分:0 
谢谢啦
我把
do while .....
 .....  
loop  代码给改了下

IF ... Then
.....

END IF

因为我的分页是封装了的


2010-04-06 20:11
快速回复:[求助 ASP]有两个数据库,把数据库B的列出的值等于数据库A的某个值
数据加载中...
 
   



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

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