第一范文网 - 专业文章范例文档资料分享平台

Asp[1].net+复习题

来源:用户分享 时间:2025/5/15 14:30:26 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

End Sub

(3) 添加自定义过程LoadGrid(),实现根据选定班级加载数据到DataGrid控件的功能。

Private Sub LoadGrid()

da.Fill(ds, \

Dim dv As New DataView( ds.Table(“Students”) )‘用Students表初始化dv

Dim strClass As String = lstClasses.SelectedItem.Value.Trim If strClass <> \所有班级\

dv.RowFilter = \‘利用dv视图筛选班级 End If

grdStudents.DataSource = dv grdStudents.DataBind() End Sub

(4) 为Web窗体的Page_Load事件编写代码,实现的功能为:使未经登陆的用户重定向到登陆页面;调用FillDropDownList()过程以显示班级列表;调用LoadGrid()过程以加载数据到DataGrid

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '在此处放置初始化页的用户代码

If Session(\‘用户未登陆 Response.Redirect(\ Else

If Not Me.IsPostBack Then FillDropDownList() LoadGrid() End If End If

End Sub

(5) 在btnSubmit_Click实践中调用LoadGrid()过程。

(6) 为DataGrid控件的编辑按钮添加代码,分别实现编辑、取消、更新的功能。

Private Sub grdStudents_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStudents.EditCommand

grdStudents.EditItemIndex = e.Item.ItemIndex LoadGrid() End Sub

Private Sub grdStudents_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStudents.CancelCommand

grdStudents.EditItemIndex = -1 LoadGrid() End Sub

(7) 为DataGrid控件的删除按钮添加代码,实现删除记录的功能。 Private Sub grdStudents_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStudents.DeleteCommand Dim cmd As SqlCommand

Dim orgID As String = Students.DataKeys(e.Item.ItemIndex) ‘用DataKeys集合获取学生学号

Dim strDelete As String = \StudentID='\ conn.Open()

cmd = New SqlCommand(strDelete, conn) cmd.ExecuteNonQuery() ‘执行Command对象 conn.Close()

grdStudents.EditItemIndex = -1 LoadGrid() End Sub

(8) 为DataGrid控件中记录分页,编写PageIndexChanged事件过程。 Private Sub grdStudents_ (ByVal source As Object, ByVal e As_ System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles grdStudents.PageIndexChanged

grdStudents.CurrentPageIndex = e.NewPageIndex

LoadGrid() End Sub 参考答案: 一、单选题 1 D 2 A 3 B 4 D 5 B 6 B 7 C 8 B 9 B 1 A 11 12 13 14 15 A A A A C 2、程序填空题

1) Response.Cookies.Add(MyCookie) 2) Not MyCookie Is Nothing 3) Page.IsValid

4) objReader(1) = Trim(txtPassword.Text) 5) objReader.Close()

6) txtName.Text = GetLoginNameFromCookie() 7) lstClasses.DataTextField = \8) ds.Tables(\

9) dv.RowFilter = \10) Session(\

11) grdStudents.EditItemIndex = e.Item.ItemIndex 12) grdStudents.EditItemIndex = -1 13) Students.DataKeys(e.Item.ItemIndex) 14) cmd.ExecuteNonQuery()

15) grdStudents.CurrentPageIndex = e.NewPageIndex 三、简答题

1. DataSet对象有哪些特点?

内存中的数据库 ;数据源独立性 ;断开式连接 ;使用XML格式 2. 什么是存储过程?使用存储过程有什么好处?

存储过程是一些SQL语句和控制语句的集合,它有一个名称,并经过预编译作为一个独立的单元存储在数据库内。

(1) 存储过程执行起来比SQL命令文本快得多。 (2) 为应用程序提供更大的灵活性

(3) 可以在存储过程中利用Transact-SQL的强大功能。 (4) 减少网络数据量 (5) 模块化

(6) 增强数据库的安全性

3. 什么是Web Service? 组成Web Service的两个角色是什么?

Web Service即Web服务,是通过Internet协议公开的一种业务功能,它提供接口或服务,供外界使用。组成Web Service的两个角色分别是Web Service提供程序和Web Service客户端。

4. 什么是XCOPY部署? 使用XCOPY方式部署一个ASP.net应用程序有那几个

主要步骤?

XCOPY部署是一种部署ASP.NET应用程序的一种方法,其典型的做法是:本地复制时使用Windows资源管理器;远程部署时使用FTP。主要分三步:在IIS中的把目标文件夹配置为Web应用程序目录; 生成应用程序并选择所有必要的文件; 复制或者使用FTP上传必要文件

5. 如何在Web.config文件中保存连接字符串,如何在程序中访问该字符串?

(假设访问SQL Server远程服务器 MyServer 的 StudentMS数据库,用户名/密码为:sa/123)

搜索更多关于: Asp[1].net+复习题 的文档
Asp[1].net+复习题.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c81sly858ef0c4dk2wbhx_3.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top