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!

SQLDataSetCommand Constructor (String, SQLConnection)

Inintializes a new instance of the SQLDataSetCommand class with a select command string and a SQLConnection object.

[Visual Basic]
Overloads Public Sub New( _
   ByVal selectCommandText As String, _
   ByVal selectConnection As SQLConnection _
)
[C#]
public SQLDataSetCommand(
   string selectCommandText,
   SQLConnection selectConnection
);
[C++]
public: SQLDataSetCommand(
   String* selectCommandText,
   SQLConnection* selectConnection
);
[JScript]
public function SQLDataSetCommand(
   selectCommandText : String,
   selectConnection : SQLConnection
);

Parameters

selectCommandText
The select command string.
selectConnection
An SQLConnection that represents the connection.

Remarks

When an instance of SQLDataSetCommand is created, the following read/write properties are set to initial values.

Properties Initial Value
SelectCommand A new SQLCommand that has selectConnection as its connection and selectCommandText as its command text.
InsertCommand A new SQLCommand that has selectConnection as its connection.
DeleteCommand A new SQLCommand that has selectConnection as its connection.
UpdateCommand A new SQLCommand that has selectConnection as its connection.
MissingMappingAction MissingMappingAction.Passthrough
MissingSchemaAction MissingSchemaAction.Add

You can change the value of any of these properties through a separate call to the property.

Example [Visual Basic]

The following example creates a SQLDataSetCommand with a select command string and a SQLConnection as parameters.

[Visual Basic]

Sub CreateDataSetCommand ()
   Dim sqlDataSetComm As SQLDataSetCommand
   Dim mySelectComm As String
   Dim myConnection As String
   Dim mySQLConnect As SQLConnection
   ' Set myConnection to the connection text
   myConnection = "Provider=SQLSQL.1;User ID=sa;PASSWORD=;" _
    + "Initial Catalog=Northwind;Data Source=vbsql7;"
   ' Set mySelectComm to the select command text
   mySelectComm = "SELECT intID, vchFirstName, vchLastName " _
    + "FROM Customers"
   ' Initialize mySQLConnect as a new object
   mySQLConnect = New SQLConnection myConnection
   ' Initialize sqlDataSetComm as a new object
   sqlDataSetComm = new SQLDataSetObject mySelectComm, mySQLConnect
   ' Set the action to take when a table or column is missing
   sqlDataSetComm.MissingSchemaAction = MissingSchemaAction.Add
End Sub

See Also

SQLDataSetCommand Class | SQLDataSetCommand Members | System.Data.SQL Namespace | SQLDataSetCommand Constructor Overload List | MissingMappingAction | MissingSchemaAction