Generates the insert, update, or delete commands when each is in a default state.
[Visual Basic] Public Sub GenerateUpdateCommands( _ ByVal optimisticQueries As Boolean, _ ByVal refreshStatement As Boolean, _ ByVal forStoredProcedure As Boolean _ ) [C#] public void GenerateUpdateCommands( bool optimisticQueries, bool refreshStatement, bool forStoredProcedure ); [C++] public: void GenerateUpdateCommands( bool optimisticQueries, bool refreshStatement, bool forStoredProcedure ); [JScript] public function GenerateUpdateCommands( optimisticQueries : Boolean, refreshStatement : Boolean, forStoredProcedure : Boolean );
Exception Type | Condition |
---|---|
ExecuteRequiresConnection | The connection does not exist. |
The following example generates the insert, delete, and update commands using optimistic queries, refresh statements and stored procedures.
[Visual Basic]
Sub CreateCommAndUpdate () Dim myConnectText As String Dim mySelect As String Dim myConnect As ADOConnection Dim myDataSetComm As ADODataSetCommand ' Initialize the data set command myDataSetComm = New ADODataSetCommand ' Set my connection text myConnectText = "Provider=SQLADO.1;User ID=sa;PASSWORD=;" _ + "Initial Catalog=Northwind;Data Source=vbsql7;" ' Inititalize my connection object myConnect = New ADOConnection myConnectText ' Set my select command text mySelect = "SELECT intID, vchFirstName, vchLastName, " _ + "chState FROM Customers" ' Set the select command Set myDataSetComm.SelectCommand.CommandText = mySelect ' Set the connection for select command to use Set myDataSetComm.SelectCommand.ActiveConnection = myConnect ' generate commands with optimistic queries, refreshed statements, and stored procedures myDatSetComm.GenerateUpdateCommands true, true, true End Sub
DBDataSetCommand Class | DBDataSetCommand Members | System.Data.Internal Namespace