实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc

上传人:汽*** 文档编号:558927676 上传时间:2022-10-07 格式:DOC 页数:4 大小:647KB
返回 下载 相关 举报
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第1页
第1页 / 共4页
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第2页
第2页 / 共4页
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第3页
第3页 / 共4页
实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc》由会员分享,可在线阅读,更多相关《实验八 商品分类显示功能的实现 - 实验八商品分类显示功能的实现.doc(4页珍藏版)》请在金锄头文库上搜索。

1、实验八 商品分类显示功能的实现【实验目的与要求】 通过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

2、.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 Protect

3、ed 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

4、 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) Ha

5、ndles 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 Su

6、b 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 = Nothi

7、ng 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 intCu

8、rrIndex.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 Publ

9、ic 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) En

10、d 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.

11、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 lblStatus.Text += End Sub Private Sub Mylist_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mylist.SelectedIndexChanged End SubEnd Class

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号