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

ASP.NET
[EnterpriseServices]利用assembly定义我们的组件在COM+中的注册方式
crystal reports for Visual Studio .NET(webformsample)
XML指南:微软的XML解析器
展现C# 清单5.10 生成exe文件执行的问题
vb.net 读写xml方法(1)
选择文件夹的对话框控件c#
特洛伊木马服务器源代码(C#)
上传图片画带阴影的水印.(C#)
vb.net读写xml(2)--实现datagrid与xml的沟通(原创)
列出所有的sheet,然后点击其中的一个,自动跳过去
从VB中的Datagride中向excel导入数据
XML指南:XML CDATA
XML指南:XML编码
XMLDOM对象方法:Document对象方法
XMLDOM对象方法:对象事件
XMLDOM对象方法:对象属性
[一个登录窗体的完整范例,包括登录,密码更改,输入错误三次退出]
[关于判断输入数据是否在数据库中的方法。]
[VBA]office中内建的faceid所对应的图标
web组件设计,利用接口(IPostBackDataHandler)产生数据回传的问题

ASP.NET 中的 AddNew Method Example


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


'This example uses the AddNew method to create a new record with the specified 'name. The AddName function is required for this procedure to run.
Sub AddNewX()
Dim dbsNorthwind As Database Dim rstEmployees As Recordset Dim strFirstName As String Dim strLastName As String
Set dbsNorthwind = OpenDatabase("Northwind.mdb") Set rstEmployees = _ dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)
' Get data from the user. strFirstName = Trim(InputBox( _ "Enter first name:")) strLastName = Trim(InputBox( _ "Enter last name:"))
' Proceed only if the user actually entered something
' for both the first and last names. If strFirstName <> "" and strLastName <> "" Then
' Call the function that adds the record. AddName rstEmployees, strFirstName, strLastName
' Show the newly added data. With rstEmployees Debug.Print "New record: " & !FirstName & _ " " & !LastName ' Delete new record because this is a demonstration. .Delete End With

Else Debug.Print _ "You must input a string for first and last name!"
End If
rstEmployees.Close dbsNorthwind.Close
End Sub
Function AddName(rstTemp As Recordset, _ strFirst As String, strLast As String)
' Adds a new record to a Recordset using the data passed ' by the calling procedure. The new record is then made ' the current record. With rstTemp .AddNew !FirstName = strFirst !LastName = strLast .Update .Bookmark = .LastModified End With
End Function