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

ASP.NET
在C#中导入WebBrowser控件,生成具有强名称的程序集
Asp.Net中的脚本回调和Server.Transfer页面传值
暂时性的解决datagrid控件数据绑定时候xxx字段不属于xxx表的错误
http://www.donews.net/yangwl/archive/2004/10/17/136872.aspx
Some tips for using visual studio .net
Grasshopper简介(节选)
ORACLE 常用的SQL语法和数据对象
[DNN学习所得]让IE也能实现解压缩功能(提供演示源码下载)
学习笔记之Microsoft Windows服务
关于XML:以对象模型为中心
P&P Enterprise Library Extensions
简易的字符替换,可以用于用户自我介绍输入框,简单新闻回复& etc.
缩略图多路径多格式保存
"关机/休眠/重启/注销"的类
[DNN功能]自己动手做语言包
处理WinForm多线程程序时的陷阱
获得光标在多行textbox中的行与列的函数
ADO.NET 和 ADO 的比较
vb.net类的封装,继承,多态,抽象之一
Display XML in AxSHDocVw.AxWebBrowser

ASP.NET 中的 AddNew Method Example


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