ASP无限极分类-运行报错
分类管理页Admin_class.asp,实现无限极分类并进行类的添加、删除、修改.代码如下:程序代码:
<!--#include file="../Admin.Class.asp"--> <% Set Admin=New WuAdmin Select Case Request.QueryString("go") Case "classlist" '//分类管理 Call Admin.ClassList(1) Case "addclassok" '//添加分类处理 Call Admin.AddClassOK(1,Trim(Request.Form("ClassName")),Trim(Request.Form("ClassList"))) Case "editclass" '//编辑分类 Call Admin.EditClass(1,CInt(Request.QueryString("id"))) Case "editclassok" '//编辑分类处理 Call Admin.EditClassOK(1,CInt(Request.Form("id")),Trim(Request.Form("ClassName")),Trim(Request.Form("ClassList"))) Case "delclass" '//删除分类处理 Call Admin.Delclass(1,CInt(Request.QueryString("id"))) Case Else '//分类管理 Call Admin.ClassList(1) End Select CloseAdmin() %>
Admin.Class.asp页,包含了WuAdmin类的对象、方法。代码如下:
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% Function CloseAdmin() On Error Resume Next If IsObject(Admin) Then:Set Admin=Nothing:End If End Function %> <% Class WuAdmin Private Sub Class_initialize Dim Driver Driver="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("..\#%20Data\A%20#5U.mdb") Set conn=Server.CreateObject("ADODB.connection") conn.Open Driver If Err Then:Err.Clear:conn.close:set conn=Nothing:Response.Write"数据库连接出错!":Response.End:End If End Sub Private Sub Class_terminate() If IsObject(conn) Then:conn.Close:Set conn=Nothing:End If End Sub Public Function Classlist(ChannelID) Response.Write("<div class='right_title'>分类管理</div>") Response.Write("<div class='right_item'>") Response.Write("<table width='90%'>") Dim Sql,Rs,sql2,rs2 Sql="Select * From [Class] where ChannelID="&CInt(ChannelID)&" Order By ClassList" 'Response.Write "Select * From [Class] where ChannelID="&CInt(ChannelID)&" Order By ClassList" 'Response.End() Set Rs=Server.Createobject("Adodb.Recordset") Rs.Open Sql,Conn,1,1 '//这 就 是 33 行 ~~~!!!!@@@@#####@@@@@## Do While Not(Rs.Eof) Response.Write("<tr style='height:20px;'><td width='*'>") If Rs("ClassID")=0 Then Response.Write(" <img src='img/+.gif' alt='' /> <a href='?go=editclass&id="&Rs("ID")&"'>"&Rs("ClassName")&"</a>") Else For I=1 To Rs("ClassDeep") Response.Write(" ") Next Response.Write(" <img src='img/+-.gif' alt='' /><img src='img/-.gif' alt='' /> <a href='?go=editclass&id="&Rs("ID")&"'>"&Rs("ClassName")&"</a>") End if Response.Write("</td><td width='100px'>") Response.Write("[<a href='?go=editclass&id="&Rs("ID")&"'>编辑</a>]") Response.Write("[<a href='#' onclick=""if(confirm('您确定删除吗?删除前请检查再次分类下是否有数据,若有会自动删除!')){location.href='?go=delclass&id="&Rs("id")&"'}return false;"">删除</a>]") Response.Write("</td></tr>") Rs.Movenext Loop If rs.eof And rs.bof Then Response.Write("<div style='text-align:center;line-height:100px;'>对不起,暂时没有分类!</div>") End if Rs.Close Set Rs=Nothing Response.Write("</table>") Response.Write("<form action='?go=addclassok' method='post'><p class='p' align='center'>") Response.Write("添加分类名称:<input name='ClassName' class='input' type='text' size='20' /> ") Response.Write("<select name='ClassList'>") Response.Write("<option value='parent'>--不选择分类--</option>") sql2="select * from [Class] where ChannelID="&CInt(ChannelID)&" order by ClassList" set rs2=Server.CreateObject("Adodb.recordset") rs2.open sql2,conn,1,1 Do while not(rs2.eof) Response.Write("<option value='"&rs2("ClassList")&"'>") For i=1 to rs2("ClassDeep") Response.Write(" ") Next Response.Write("├"&rs2("ClassName")&"</option>") rs2.movenext Loop rs2.close set rs2=nothing Response.Write("</select>") Response.Write(" <input name='addclass' class='button' type='submit' value='增加分类'></p><form>") Response.Write("<div class='br'></div>") Response.Write("</div>") End Function Public Function AddClassOK(ChannelID,ClassName,ClassList) '添加类确定(省略代码) End Function Public Function EditClass(ChannelID,ClassID) '编辑类(省略代码) End Function Public Function EditClassOK(ChannelID,ClassID,ClassName,ClassList) '编辑类确定(省略代码) End Function Public Function Delclass(ChannelID,ClassID) '删除类(代码省略) End Function End Class %>
运行完之后报错了~~
程序代码:
错误类型: ADODB.Recordset (0x800A0BB9) 参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。 /5u/Admin/Admin.Class.asp, 第 33 行
class 数据结构:
字段备注:
请各位大侠帮我看看是什么原因,我初学类的编程,不知道哪里出错了~~谢谢啊。。。成功了一定把代码发出来给大家
[[it] 本帖最后由 xmuer 于 2008-11-18 13:54 编辑 [/it]]