当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > Edit Method Example

ASP.NET
asp.net 产生随机颜色实现代码
asp.ent(C#)中判断空字符串的3种方法以及性能分析
asp.net 基于forms验证的目录角色权限的实现
ASP.NET 统计图表控件小结
asp.net 动态引用样式表代码
asp.net 获取IP的相关资料
真正的获取客户端真实IP地址及利弊分析
asp.net(c#)文件下载实现代码
asp.net 不用GridView自带删除功能,删除一行数据
asp.net forms身份验证,避免重复造轮子
asp.net 站点URLRewrite使用小记
asp.net Gridview行绑定事件新体会
asp.net MVC实现简单的上传功能
asp.net web.config加密解密方法
aspx实现的 jquery ui 的 flexgrid demo
ASP.NET Internet安全Forms身份验证方法
asp.net使用for循环实现Datalist的分列显示功能
jQuery AJax调用asp.net webservers的实现代码
ASP.NET 页面刷新和定时跳转代码整理
asp.net GridView控件鼠标移动某行改变背景颜色(方法一)

ASP.NET 中的 Edit Method Example


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 52 ::
收藏到网摘: n/a


'This example uses the Edit method to replace the current data with the 'specified name. The EditName procedure is required for this procedure to run.
Sub EditX()
Dim dbsNorthwind As Database Dim rstEmployees As Recordset Dim strOldFirst As String Dim strOldLast As String Dim strFirstName As String Dim strLastName As String
Set dbsNorthwind = OpenDatabase("Northwind.mdb") Set rstEmployees = _ dbsNorthwind.OpenRecordset("Employees", _ dbOpenDynaset)
' Store original data. strOldFirst = rstEmployees!FirstName strOldLast = rstEmployees!LastName
' Get new data for record.
strFirstName = Trim(InputBox( _ "Enter first name:")) strLastName = Trim(InputBox( _ "Enter last name:"))
' Proceed if the user entered something for both fields. If strFirstName <> "" and strLastName <> "" Then ' Update record with new data. EditName rstEmployees, strFirstName, strLastName

With rstEmployees ' Show old and new data. Debug.Print "Old data: " & strOldFirst & _ " " & strOldLast Debug.Print "New data: " & !FirstName & _
" " & !LastName ' Restore original data because this is a ' demonstration. .Edit !FirstName = strOldFirst !LastName = strOldLast .Update End With
Else Debug.Print _ "You must input a string for first and last name!" End If
rstEmployees.Close dbsNorthwind.Close
End Sub
Sub EditName(rstTemp As Recordset, _ strFirst As String, strLast As String)
' Make changes to record and set the bookmark to keep
' the same record current. With rstTemp .Edit !FirstName = strFirst !LastName = strLast .Update .Bookmark = .LastModified End With
End Sub