日期:2014-05-17  浏览次数:21023 次

嵌套调用记录集的写法,不会了,高手来?

<%
Dim   c_id
c_id       =   Clng(Request( "Select_cid "))

'-------------------------------------
'就是这一段需要注意
Call   Open_Conn()       '--打开记录集
Sql= "Select   id,menuname   From   Menu_Unlimited   a  
Where   exists(Select   *   From   Menu_Unlimited   b   Where   b.p_id   =   a.id   and   b.id   =   '&c_id& ') "               '--根据传来的c_id值计算出他的上级id及name  
Set   Rs=server.CreateObject( "adodb.recordset ")
Rs.open   sql,Conn,1,1
'-------------------------------------

Call   Open_Conn()
  Sql1   =   "Insert   Into   ContentTable   (p_id,p_name,c_id,c_name)   values( "&   Rs( "p_id ")   & ", ' "&   Rs( "p_name ")   & " ', ' "&   ( "c_id ")   & " ', "&   Rs( "c_name ")   & ")              
Call   Insert_Data()

------解决方案--------------------
Call Open_Conn() '--打开记录集
sub open_conn()
Sql= "Select id,menuname From Menu_Unlimited a
Where exists(Select * From Menu_Unlimited b Where b.p_id = a.id and b.id = '&c_id& ') " '--根据传来的c_id值计算出他的上级id及name
Set Rs=server.CreateObject( "adodb.recordset ")
Rs.open sql,Conn,1,1
end sub
?
------解决方案--------------------
没看明白什么意思。
楼主说一下要实现什么功能。。
------解决方案--------------------
Sql= "Select id,menuname From Menu_Unlimited Where id in (Select p_id From Menu_Unlimited Where id = '&c_id& ') "
------解决方案--------------------
看晕了。。、

到底是数还是记录集?