Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL Server database. This class cannot be inherited.
Assembly: System.Data (in System.Data.dll)
Initializes a new instance of theclass.
Initializes a new instance of the SelectCommand and a connection string.class with a
Gets or sets a value that specifies whether to generate an exception when an error is encountered during a row update.(Inherited from DataAdapter.)
Gets or sets a Transact-SQL statement or stored procedure to delete records from the data set.
Gets or sets the behavior of the command used to fill the data adapter.(Inherited from DbDataAdapter.)
Gets or sets a Transact-SQL statement or stored procedure to insert new records into the data source.
Determines the action to take when incoming data does not have a matching table or column.(Inherited from DataAdapter.)
Gets or sets whether the Fill method should return provider-specific values or common CLS-compliant values.(Inherited from DataAdapter.)
Gets or sets a Transact-SQL statement or stored procedure used to select records in the data source.
Gets or sets the number of rows that are processed in each round-trip to the server.(Overrides DbDataAdapter.UpdateBatchSize.)
Gets or sets a Transact-SQL statement or stored procedure used to update records in the data source.
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)
Determines whether the specified object is equal to the current object.(Inherited from Object.)
|Fill(DataSet, Int32, Int32, String)|
|Fill(Int32, Int32, DataTable())|
|FillSchema(DataSet, SchemaType, String)|
Gets the parameters set by the user when executing an SQL SELECT statement.(Inherited from DbDataAdapter.)
Serves as the default hash function. (Inherited from Object.)
Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Returned when an error occurs during a fill operation.(Inherited from DataAdapter.)
Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires.
Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires.
For a description of this member, see Clone.
Indicates how a source table is mapped to a dataset table.(Inherited from DataAdapter.)
For a description of this member, see DeleteCommand.
For a description of this member, see InsertCommand.
For a description of this member, see SelectCommand.
For a description of this member, see UpdateCommand.
The DataSet and SQL Server for retrieving and saving data. The provides this bridge by mapping Fill, which changes the data in the DataSet to match the data in the data source, and Update, which changes the data in the data source to match the data in the DataSet, using the appropriate Transact-SQL statements against the data source. The update is performed on a by-row basis. For every inserted, modified, and deleted row, the Update method determines the type of change that has been performed on it (Insert, Update, or Delete). Depending on the type of change, the Insert, Update, or Delete command template executes to propagate the modified row to the data source. When the fills a DataSet, it creates the necessary tables and columns for the returned data if they do not already exist. However, primary key information is not included in the implicitly created schema unless the MissingSchemaAction property is set to AddWithKey. You may also have the create the schema of the DataSet, including primary key information, before filling it with data using FillSchema. For more information, see Adding Existing Constraints to a DataSet., serves as a bridge between a
If you are using SQL Server stored procedures to edit or delete data using a DataAdapter, make sure that you do not use SET NOCOUNT ON in the stored procedure definition. This causes the rows affected count returned to be zero, which the DataAdapter interprets as a concurrency conflict. In this event, a DBConcurrencyException will be thrown.
When an instance ofis created, the read/write properties are set to initial values. For a list of these values, see the constructor.
For every column that you propagate to the data source on Update, a parameter should be added to the InsertCommand, UpdateCommand, or DeleteCommand. The SourceColumn property of the DbParameter object should be set to the name of the column. This setting indicates that the value of the parameter is not set manually, but is taken from the particular column in the currently processed row.
The following example uses the SqlCommand, , and SqlConnection to select records from a database and populate a DataSet with the selected rows. The filled DataSet is then returned. To accomplish this, the method is passed an initialized DataSet, a connection string, and a query string that is a Transact-SQL SELECT statement.
Public Function SelectRows( _ ByVal dataSet As DataSet, ByVal connectionString As String, _ ByVal queryString As String) As DataSet Using connection As New SqlConnection(connectionString) Dim adapter As New SqlDataAdapter() adapter.SelectCommand = New SqlCommand( _ queryString, connection) adapter.Fill(dataSet) Return dataSet End Using End Function
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.