标题:级联查询
只看楼主
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
结帖率:91.67%
已结贴  问题点数:10 回复次数:18 
级联查询
我知道这个查询语句是错的可是不知道怎么改,哪位大虾帮帮忙  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
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:10 
你要查询什么?
2011-03-23 14:52
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
我想根据已经知道的PerId值,去查询有关系的2个表
db1.rar (13.73 KB)
2011-03-23 15:36
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
查询两个表的信息还可以用多表查询
select * from PersonTbl,test Where PersonTbl.PerId=1 or test.PerId=1
2011-03-23 16:47
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
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
不明白一个查询而已为什么要用事物来表达?为何非得要把简单问题复杂化呢?
2011-03-23 22:14
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
恩有道理,我想问一下在一个页面里可以同时用
<!--#include file="Conn.asp" -->
<!--#include file="Conn1.asp"-->
吗??2个是不同的数据库
2011-03-24 08:54
jansonwang
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:60
专家分:147
注 册:2010-11-25
得分:0 
应该只要你的conn和conn1里面定义的数据库对象名要不一样才能区别使用不同的数据库啊。你也可以写到一个文件中去啊。
2011-03-25 15:50



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




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

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