找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 80|回复: 2

请大家进来帮忙看看这短程序,有错误,请帮忙指点一下,谢谢!

[复制链接]
发表于 2009-9-15 00:15:44 | 显示全部楼层 |阅读模式 IP:江苏扬州
<%@ Page Language="VB" Debug="True" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="system.data.oledb" %>
<script runat="server">

    ' Insert page code here
    '
    dim pagesize as integer = 5
    sub bindlist(byval pageno as integer)
    dim conn as new oledbconnection()
    dim cmd as new oledbcommand()
    conn.connectionstring="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("guestbook.mdb")
    conn.open()
    cmd.connection=conn
    cmd.commandtext="select * from book order by posttime desc"
    dim objadpt as new oledbdataadapter(cmd)
    dim ds as new dataset()
    objadpt.fill(ds,"book")
    conn.close()
    dim book as datatable=ds.tables("book")
    dim totalrec as integer=book.rows.count
    showtotalrec.text=totalrec
    dim totalpage as integer
    if totalrec < pagesize then
    totalpage=1
    else
    if totalrec mod pagesize <> 0 then
    totalpage=totalrec\pagesize+1
    else
    totalpage=totalrec/pagesize
    end if
    end if
    showtotalpage.text=totalpage
    showcurrentpage.text=pageno
    dim tempbook as datatable=book.clone()
    dim i,j as integer
    for i=(pageno-1)*pagesize to pageno*pagesize-1
    if i<0 or i>book.rows.count-1 then exit for
    dim row as datarow=tempbook.newrow()
    for j=0 to book.columns.count-1
    row(book.columns(j).columnname)=book.rows(i).item(j)
    next
    tempbook.rows.add(row)
    next
    guestbook.datasource=tempbook
    guestbook.databind()
    end sub
    sub enabledwhatbutton()
    if session("currpage")=1 then
    firstbtn.enabled=false
    prebtn.enabled=false
    else
    firstbtn.enabled=true
    prebtn.enabled=true
    end if
    if session("currpage")=showtotalpage.text then
    nextbtn.enabled=false
    lastbtn.enabled=false
    else
    nextbtn.enabled=true
    lastbtn.enabled=true
    end if
    end sub
    sub pagechange(sender as object,e as commandeventargs)
    select case e.commandargument
    case "firstpage"
    session("currpage")=1
    case "prepage"
    session("currpage")- = 1
    case "nextpage"
    session("currpage")+=1
    case "lastpage"
    session("currpage")=showtotalpage.text
    case "postrec"
    response.redirect("post.aspx")
    case "manage"
    response.redirect("adminlogin.aspx")
    end select
    bindlist(session("currpage"))
    enabledwhatbutton()
    end sub
    sub page_init(sender as object,e as eventargs)
    bindlist(session("currpage"))
    enabledwhatbutton()
    end sub

</script>
<html>
<head>
</head>
<body>
    <center><img style="WIDTH: 1035px; HEIGHT: 144px" height="144" src="e:\source\lyb.jpg" width="1024" />
    </center>
    <form runat="server">
        <center>
            <table style="WIDTH: 937px; HEIGHT: 32px" height="32" cellspacing="0" cellpadding="0" width="937" align="center">
                <tbody>
                    <tr>
                        <td>
                            <div align="center">
                                <asp:imagebutton id="ImageButton1" runat="server" Height="25px" Width="111px" imageurl="e:\source\wyly.jpg" commandargument="postrec" oncommand="pagechange"></asp:imagebutton>
                            </div>
                        </td>
                        <td>
                            <div align="center">
                                <asp:imagebutton id="firstbtn" runat="server" Height="25px" Width="108px" imageurl="e:\source\first.jpg" commandargument="firstpage" oncommand="pagechange"></asp:imagebutton>
                            </div>
                        </td>
                        <td>
                            <div align="center">
                                <asp:imagebutton id="prebtn" runat="server" Height="26px" Width="112px" imageurl="e:\source\prev.jpg" commandargument="prepage" oncommand="pagechange"></asp:imagebutton>
                            </div>
                        </td>
                        <td>
                            <div align="center">
                                <asp:imagebutton id="nextbtn" runat="server" Height="29px" Width="118px" imageurl="e:\source\next.jpg" commandargument="nextpage" oncommand="pagechange"></asp:imagebutton>
                            </div>
                        </td>
                        <td>
                            <div align="center">
                                <asp:imagebutton id="lastbtn" runat="server" Height="30px" Width="119px" imageurl="e:\source\last.jpg" commandargument="lastpage" oncommand="pagechange"></asp:imagebutton>
                            </div>
                        </td>
                        <td>
                            <div align="center">
                                <asp:imagebutton id="managebtn" runat="server" Height="32px" Width="117px" imageurl="e:\source\manage.jpg" commandargument="manage" oncommand="pagechange"></asp:imagebutton>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
            <br />
        </center>
        <center>
            <div align="left">共有<asp:Label id="showtotalpage" runat="server"></asp:Label>页,<asp:Label id="showtotalrec" runat="server"></asp:Label>条留言,当前位于<asp:Label id="showcurrentpage" runat="server"></asp:Label>页
            </div>
        </center>
    </form>
    <p>
        <asp:datalist id="guestbook" runat="server">
            <headertemplate>
                <table width="900" cellpadding="5" cellspacing="0" horizonalign="center">
                    <hr />
            </headertemplate>
            <itemtemplate>
                <tr>
                    <td bgcolor="#eeeeee">
                        留言人:<%# container.dataitem("name")%></td>
                    <td>
                      E-mail:<a href="mailto:<%# container.dataitem("email")%>">
                              <%# container.dataitem("email")%></a></td>
                    </td>
                    <td bgcolor="#eeeeee">
                        留言时间<%#container.dataitem("posttime")%></td>
                </tr>
                <tr>
                    <td colspan="3" bgcolor="#dddddd">
                        留言内容:<%# container.dataitem("text")%></td>
            </itemtemplate>
            <separatortemplate>
                <tr>
                    <td colspan="4">
                        <hr />
                    </td>
                </tr>
            </separatortemplate>
            <footertemplate>
                </table>
            </footertemplate>
        </asp:datalist>
    </p>
</body>
</html>
运行结果是
Server Error in '/' Application.
--------------------------------------------------------------------------------

email is neither a DataColumn nor a DataRelation for table book.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: email is neither a DataColumn nor a DataRelation for table book.

Source Error:


Line 148:                        留言人:<%# container.dataitem("name")%></td>
Line 149:                    <td>
Line 150:                        E-mail:<a href="mailto:<%# container.dataitem("email")%>"> <%# container.dataitem("email")%></a></td>
Line 151:                    </td>
Line 152:                    <td bgcolor="#eeeeee">
发表于 2009-12-25 21:05:05 | 显示全部楼层 IP:广东深圳
楼主强呀,这样贴子也能发表出来,对你佩服之心比长江的水还多哦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 07:17 , Processed in 0.136056 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表