首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

求解语句的写法,好心人进解决方案

2012-03-09 
求解语句的写法,好心人进%Dimc_id,S,StrTime_Name,real_idRandomizeTimerSInt((8999)*Rnd+1000)StrAsc(

求解语句的写法,好心人进
<%
Dim   c_id,S,StrTime_Name,real_id

Randomize   Timer
S                             =   Int((8999)   *   Rnd   +   1000)
Str                         =   Asc(Hex(S))

Print_DateTime   =   Now()
Time_Name             =   MakeFileName(Print_DateTime)
real_id                 =   "a "   &   Time_Name   &   Str  

c_id                       =   Cint(Request( "Select_cid "))
response.write   c_id
Article_Title     =   Request( "Article_Title ")
      Doc_Content   =   trim(Request.form( "cnWords "))  
      Doc_Content   =   Replace(Doc_Content, " <script ", " <sscript ")  
      Doc_Content   =   Replace(Doc_Content, "/script> ", "/scripts> ")
      Doc_Content   =   Replace(Doc_Content, "/script   > ", "/scripts> ")
RealLink               =   Request( "RealLink ")
'-------------------------------这一段有问题
Href_Add               =   "Content.asp?id=&   real_id   & "
'-------------------------------
AddUser                 =   Session( "Admin_UserName ")
AddTime                 =now()

Call   Find_UpClass()
Call   Add_Content

Function   Find_UpClass()
      Call   Open_Conn()
'-------------------------------这一段有问题
      Sql1= "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   & ") "
'-------------------------------
      Set   Rs1=server.CreateObject( "adodb.recordset ")
      Rs1.open   sql1,Conn,1,1
End   Function

Function   Add_Content
      Call   Open_Conn()
      Call   Find_UpClass()
'-------------------------------这一段有问题,提示“类型不匹配:   'Rs1 '”
      Sql2= "Insert   into   ContentTable   (p_id,p_name,c_id,c_name,Article_Title,Article_Content,Href_Add,AddUser,AddTime,RealLink,real_id)   values   ( "&   Rs1( "id ")   & ", "&   Rs1( "menuname ")   & ", ' "&   c_id   & " ', ' "&   c_name   & " ', ' "&   Article_Title   & " ', ' "&   Doc_Content   & " ', ' "&   Href_Add   & " ', ' "&   AddUser   & " ', ' "&   AddTime   & " ', ' "&   RealLink   & " ', ' "&   real_id   & " ') "
'-------------------------------
      Set   Rs2=server.CreateObject( "adodb.recordset ")


      Rs2.open   sql2,Conn,1,1
      Call   Insert_Data()
End   Function


Function   MakeFileName(FName)
    FName   =   Replace(FName, "- ", " ")
    FName   =   Replace(FName, "   ", " ")  
    FName   =   Replace(FName, ": ", " ")
    FName   =   Replace(FName, "PM ", " ")
    FName   =   Replace(FName, "AM ", " ")
    FName   =   Replace(FName, "上午 ", " ")
    FName   =   Replace(FName, "下午 ", " ")
    'FName   =   right(FName,6)
    MakeFileName   =   FName
End   Function


Function   Insert_Data()
      'Response.Write(Sql)
      Set   Rs   =   Server.CreateObject( "ADODB.Recordset ")
      Rs.Open   Sql,Conn,3,1
End   Function


好心人看一下,标注出的还有没标出的有哪些错误,如何改,我尝试写的不知如何,请指教



[解决办法]
Href_Add = "Content.asp?id=& real_id & "
Href_Add = "Content.asp?id= "& real_id
-------------------------------------------------
Sql1= "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 & ") "
Sql1= "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 & " ') "
-------------------------------------------------
Rs1( "id ")
Rs1( "menuname ")
类型不匹配?打印的出结果吗?
-------------------------------------------------个人意见,仅供参考
[解决办法]
你把Rs1( "id ")和 Rs1( "menuname ") response.write 出来,看看有没有值,如果有看看是什么类型,和ContentTable 表中相应的字段的类型是否一致
[解决办法]
Set Rs1=server.CreateObject( "adodb.recordset ")
Rs1.open sql1,Conn,1,1
这里可能检索出来的不止一条数据吧?
你加一个循环看看:
do while not rs1.eof

response.write Rs1( "id ")& " <br> "

rs1.movenext
loop
[解决办法]
全文只能用一次,你把数据库打开连接后没有关闭,因此第二次打开会造成重定义

热点排行