NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DBDataSetCommand.ForceGenerateUpdateCommand

Force the generation of the insert, update, or delete commands from the select command.

[Visual Basic]
MustOverride Protected Sub ForceGenerateUpdateCommand( _
   ByVal updateType As Integer, _
   ByVal optimisticQueries As Boolean, _
   ByVal refreshStatement As Boolean, _
   ByVal forStoredProcedure As Boolean, _
   ByRef sessionState As Object _
)
[C#]
protected abstract void ForceGenerateUpdateCommand(
   int updateType,
   bool optimisticQueries,
   bool refreshStatement,
   bool forStoredProcedure,
   ref object sessionState
);
[C++]
protected: virtual void ForceGenerateUpdateCommand(
   int updateType,
   bool optimisticQueries,
   bool refreshStatement,
   bool forStoredProcedure,
   Object** sessionState
) = 0;
[JScript]
protected abstract function ForceGenerateUpdateCommand(
   updateType : int,
   optimisticQueries : Boolean,
   refreshStatement : Boolean,
   forStoredProcedure : Boolean,
   sessionState : Object
);

Parameters

updateType
[To be supplied.]
optimisticQueries
true to make optimistic queries; otherwise, false.
refreshStatement
true to refresh the query statement; otherwise, false.
forStoredProcedure
true to use the query statement to when generating a stored procedure; otherwise, false.
sessionState
[To be supplied.]

Exceptions

Exception Type Condition
ADP.ExecuteRequiresConnection The SelectCommand or its ActiveConnection has not been initialized.

Example [Visual Basic]

The following example will force the generation of the insert, delete and update commands using optimistic queries, refresh statements, and no stored procedures.

[Visual Basic]

Sub CreateCommAndForceUpdate ()
    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
    ' force generation of delete, insert, and update commands
    Try
       ' make optimistic queries, refresh statements, no stored procedures
       myDatSetComm.ForceGenerateUpdateCommands true, true, false
    Catch e As ExecuteRequiresConnection
       ' No connection to a data store found
       Dim msgBox As MessageBox
       msgBox.Show "The Select command or its active connection have" _
     + " not been initialized ..."
    End Try
 End Sub

See Also

DBDataSetCommand Class | DBDataSetCommand Members | System.Data.Internal Namespace | InsertCommand | UpdateCommand | DeleteCommand | SelectCommand