ObjectDataSourceView.ExecuteInsert(IDictionary) 方法
定义
执行插入操作,方法是使用指定的 values 集合调用由 InsertMethod 属性标识的业务对象方法。Performs an insert operation by calling the business object method that is identified by the InsertMethod property using the specified values collection.
protected:
override int ExecuteInsert(System::Collections::IDictionary ^ values);
protected override int ExecuteInsert (System.Collections.IDictionary values);
override this.ExecuteInsert : System.Collections.IDictionary -> int
Protected Overrides Function ExecuteInsert (values As IDictionary) As Integer
参数
- values
- IDictionary
与 IDictionary 属性一起使用以执行插入操作的参数的 InsertMethod。A IDictionary of parameters used with the InsertMethod property to perform the insert operation. 如果没有与方法关联的参数,则传递 null。If there are no parameters associated with the method, pass null.
返回
插入的行数;否则,如果行数未知,则为 -1。The number of rows inserted; otherwise, -1, if the number is not known. 有关详细信息,请参阅 Insert。For more information, see Insert.
例外
values 为 null 或空。values is null or empty.
注解
ObjectDataSourceView类实现继承 ExecuteInsert 方法,以使用业务对象将数据插入基础数据存储区中。The ObjectDataSourceView class implements the inherited ExecuteInsert method to insert data into an underlying data store using a business object. 页面开发人员和数据绑定控件作者不会直接调用 ExecuteInsert 方法; 而是使用公开的 Insert 方法。Page developers and data-bound control authors do not call the ExecuteInsert method directly; instead, use the publicly exposed Insert method.
在执行插入之前,将 OnInserting 调用方法来引发 Inserting 事件。Before the insert is performed, the OnInserting method is called to raise the Inserting event. 你可以处理此事件以检查参数的值,并在调用方法之前执行任何预处理 Insert 。You can handle this event to examine the values of the parameters and perform any preprocessing before the Insert method is called.
若要执行插入操作, ObjectDataSourceView 控件使用反射来调用由属性标识的方法 InsertMethod 和集合中的任何关联参数 values ,然后执行该操作。To perform an insert operation, the ObjectDataSourceView control uses reflection to call the method that is identified by the InsertMethod property and any associated parameters that are in the values collection, and then executes it. 操作完成后, OnInserted 调用方法来引发 Inserted 事件。After the operation completes, the OnInserted method is called to raise the Inserted event. 您可以处理此事件以检查任何返回值、错误代码以及执行任何后续处理。You can handle this event to examine any return values, error codes, and perform any post-processing.
有关返回插入的行数的详细信息,请参阅 Insert 。For more information on returning the number of rows inserted, see Insert.