标题:级联查询
取消只看楼主
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
结帖率:91.67%
已结贴  问题点数:10 回复次数:11 
级联查询
我知道这个查询语句是错的可是不知道怎么改,哪位大虾帮帮忙  select * from test a left join PersonTbl b on a.PerId=b.PerId where PerId = "& PerId
搜索更多相关主题的帖子: test 
2011-03-22 19:15
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
为什么没人回答我的问题
2011-03-23 13:45
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
我想根据已经知道的PerId值,去查询有关系的2个表
db1.rar (13.73 KB)
2011-03-23 15:36
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
能不能用事务来表达,但是事务怎么写啊
2011-03-23 19:38
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
我这样写行吗  
conn.begintrans
Rs.Open "select * from PersonTbl where PerId = "& PerId , Conn , 1 , 1
If Rs.Eof Then
    Question = ""
    Answer = ""
    Email = ""
   
    RealName = ""
    Sex = ""
    Age = ""
    Nation = ""
    Political = ""
    Birthplace = ""
    Marriage = ""
    Qualification = ""
    Standing = ""
    Weight = ""
    Salary = ""
    Nature = ""
    Position_b = ""
    Position_s = ""
    JobPost = ""
    areaname = ""
    NowAddr = ""
    HomeAddr = ""
    QQ = ""
    MSN = ""
    Tel = ""
    Mobile = ""
   
    IsHidden = ""
    IsLock = ""
    IsTj = ""
    IsGj = ""
    IsSh = ""
    LoginQuantity = ""
    ThisLoginDate = ""
    ThisLoginIp = ""
    ViewQuantity = ""
   
    RegFromIp = ""
    RegDate = ""
Else
   
    Question = Rs("Question")
    Answer = Rs("Answer")
    Email = Rs("Email")
   
    RealName = Rs("RealName")
    Sex = Rs("Sex")
    Age = Rs("Age")
    Nation = Rs("Nation")
    Political = Rs("Political")
    Birthplace = Rs("Birthplace")
    Marriage = Rs("Marriage")
    Qualification = Rs("Qualification")
    Standing = Rs("Standing")
    Weight = Rs("Weight")
    Salary = Rs("Salary")
    Nature = Rs("Nature")
    Position_b = Rs("Position_b")
    Position_s = Rs("Position_s")
    JobPost = Rs("JobPost")
    areaname = Rs("areaname")
    NowAddr = Rs("NowAddr")
    HomeAddr = Rs("HomeAddr")
    QQ = Rs("QQ")
    MSN = Rs("MSN")
    Tel = Rs("Tel")
    Mobile = Rs("Mobile")
   
    IsHidden = Rs("IsHidden")
    IsLock = Rs("IsLock")
    IsTj = Rs("IsTj")
    IsGj = Rs("IsGj")
    IsSh = Rs("IsSh")
    LoginQuantity = Rs("LoginQuantity")
    ThisLoginDate = Rs("ThisLoginDate")
    ThisLoginIp = Rs("ThisLoginIp")
    ViewQuantity = Rs("ViewQuantity")
    RegFromIp = Rs("RegFromIp")
    RegDate = Rs("RegDate")
End If
Rs.Close
if Conn.Errors.Count>0 then
    Conn.Errors.Clear
    Conn.RollBackTrans
    response.Redirct "Person_Edit.asp"
   End if
rs.open "select * from test where PerId = "& PerId , Conn , 1 , 1
If Rs.Eof Then
    UserName = ""
    PassWord = ""
Else
    UserName = Rs("UserName")
    PassWord = Rs("PassWord")
    End if
    Rs.Close
if Conn.Errors.Count>0 then
   Conn.Errors.Clear
   Conn.RollBackTrans
   response.Redirct "Person_Edit.asp"
End if
   
2011-03-23 19:55
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
恩有道理,我想问一下在一个页面里可以同时用
<!--#include file="Conn.asp" -->
<!--#include file="Conn1.asp"-->
吗??2个是不同的数据库
2011-03-24 08:54
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
2个数据库能嵌套使用吗??有谁试过
Rs1.open "select * from test1",conn1,3,2
 Rs.open "select * from test",conn,3,2
rs.close
rs1.close
2011-03-26 15:02
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
经过尝试以后我发现2个数据库能嵌套的

例如:Rs.open "Select * from test where id=1",conn,1,1
      if Not Rs.Eof Then
      response.write("有记录")
      Esle
       Rs1.Open "Select * from test1 where id=1",conn1,1,1
      if Not Rs1.Eof Then
        response.write("有记录")
      Else
        response.write("没记录")
      End if
     Rs1.close
  End if
Rs.close
至于同一个数据库能不能用conn 和conn1 来实现上面的功能,我就没试过了。
2011-03-28 10:55
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
请教 把2个数组放在另一个数组里 怎么写
A(5)={1,2,3,4,5}
B(2)={6,7}
合并为
C(7)={1,2,3,4,5,6,7,}
2011-03-28 19:37
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
asp 语句
2011-03-29 09:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-334438-1-1.html




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

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