实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第1页
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第2页
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第3页
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

实验八 商品分类显示功能的实现【实验目的与要求】 通过ASP.NET和SQL SERVER相结合实现商品分类显示功能。【实验环境与方法】1、 Windows XP操作系统2、 装有Dreamweaver软件3、 安装了IIS组件及.NET框架4、 安装了SQL SERVER【实验内容与步骤】实现商品分类显示功能【实验注意事项】1 注意各种网页制作方法之间的配合使用。2 实验报告中要包括原代码及程序运行的截图。【实验报告】代码:Imports System.DataImports System.Data.SqlClientPublic Class xpxs Inherits System.Web.UI.Page#Region Web 窗体设计器生成的代码 该调用是 Web 窗体设计器所必需的。 Private Sub InitializeComponent() End Sub Protected WithEvents Mylist As System.Web.UI.WebControls.DataList Protected WithEvents lblStatus As System.Web.UI.WebControls.Label Protected WithEvents intPageSize As System.Web.UI.WebControls.Label Protected WithEvents intRecordCount As System.Web.UI.WebControls.Label Protected WithEvents intCurrIndex As System.Web.UI.WebControls.Label Protected WithEvents hrefFirst As System.Web.UI.HtmlControls.HtmlAnchor Protected WithEvents hrefPrevious As System.Web.UI.HtmlControls.HtmlAnchor Protected WithEvents hrefNext As System.Web.UI.HtmlControls.HtmlAnchor Protected WithEvents hrefLast As System.Web.UI.HtmlControls.HtmlAnchor 注意: 以下占位符声明是 Web 窗体设计器所必需的。 不要删除或移动它。 Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init CODEGEN: 此方法调用是 Web 窗体设计器所必需的 不要使用代码编辑器修改它。 InitializeComponent() End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then intPageSize.Text = 5 intCurrIndex.Text = 0 Call BindData() End If End Sub Sub BindData() Dim conn As New SqlConnection(server=(local);database=data;uid=lib;pwd=123456;) Dim sqlstr = select * from Prod Dim adp As New SqlDataAdapter(sqlstr, conn) Dim ds As New DataSet If Not Page.IsPostBack() Then adp.Fill(ds) intRecordCount.Text = CStr(ds.Tables(0).Rows.Count) ds = Nothing ds = New DataSet End If adp.Fill(ds, CInt(intCurrIndex.Text), CInt(intPageSize.Text), Document) Mylist.DataSource = ds.Tables(0).DefaultView Mylist.DataBind() conn.Close() PrintStatus() End Sub Public Sub ShowFirst_click(ByVal s As Object, ByVal e As EventArgs) Handles hrefFirst.ServerClick intCurrIndex.Text = 0 BindData() End Sub Public Sub ShowPrevious_click(ByVal s As Object, ByVal e As EventArgs) Handles hrefPrevious.ServerClick intCurrIndex.Text = CStr(CInt(intCurrIndex.Text) - CInt(intPageSize.Text) If CInt(intCurrIndex.Text) 0 Then intCurrIndex.Text = 0 End If BindData() End Sub Public Sub ShowNext_click(ByVal s As Object, ByVal e As EventArgs) Handles hrefNext.ServerClick If CInt(CInt(intCurrIndex.Text) + CInt(intPageSize.Text) 0 Then intCurrIndex.Text = CStr(CInt(intRecordCount.Text) - tmpInt) Else intCurrIndex.Text = CStr(CInt(intRecordCount.Text) - CInt(intPageSize.Text) End If BindData() End Sub Private Sub PrintStatus() lblStatus.Text = 总记录数: & intRecordCount.Text lblStatus.Text += 当前: lblStatus.Text += CStr(CInt(CInt(intCurrIndex.Text) CInt(intPageSize.Text) + 1) lblStatus.Text += / If (CInt(intRecordCount.Text) Mod CInt(intPageSize.Text) 0 And CInt(intRecordCount.Text) CInt(intPageSize.Text) Then lblStatus.Text += CStr(CInt(CInt(intRecordCount.Text) CInt(intPageSize.Text) + 1) ElseIf CInt(intRecordCount.Text) CInt(intPageSize.Text) Then lblStatus.Text += 1 Else lblStatus.Text += CStr(CInt(intRecordCount.Text) CInt(intPageSize.Text) End If lblSta

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论