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.GenerateUpdateCommands

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
);

Parameters

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.

Exceptions

Exception Type Condition
ExecuteRequiresConnection The connection does not exist.

Example [Visual Basic]

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

See Also

DBDataSetCommand Class | DBDataSetCommand Members | System.Data.Internal Namespace