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

ASP.NET
DVNEWS 3.2 1013版免虚拟目录的安装方法,只要三个步骤
DataRow的序列化问题
VB.net基础:使用UDP发送和接收消息
采用HttpModules来重写URLs(实践篇)
要用到事务了
DataGrid中单元格的比较
动态引用WebService,建立WebService虚拟机
[初学VB.NET]数据绑定
使用ASP调用WebService时不能以Name为数据库中的字段
在VB.NET里操作文本文件
web下打印的办法
怎样把SQL_SERVER数据库里的(类型是image)图片显示在aspx页面里的image控件里
C#中字符串的加密
中小企业信息应用的利器:DAP-Dynamic Applications Platform
数据库系统概论学习笔记
体会到译者的艰辛,也发现了他们犯的错误
IISManager V1.1 是一个在线管理IIS,维护站点组件,安全稳定,最重要的是完全免费。
VS FlexGridPro 8.0如何在window98运行---有没有升级版本,急请高手指点
给立方体添加纹理
Wrox的C#高级编程第三版第一部分第一章(1~9页)

ASP.NET 中的 AddNew Method Example


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 88 ::
收藏到网摘: 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