Export (0) Print
Expand All

DataAdapter.MissingSchemaAction Property

Determines the action to take when existing DataSet schema does not match incoming data.

[Visual Basic]
Public Overridable Property MissingSchemaAction As _
   MissingSchemaAction  Implements IDataAdapter.MissingSchemaAction
[C#]
public virtual MissingSchemaAction MissingSchemaAction {get; set;}
[C++]
public: __property virtual MissingSchemaAction get_MissingSchemaAction();
public: __property virtual void set_MissingSchemaAction(MissingSchemaAction);
[JScript]
public function get MissingSchemaAction() : MissingSchemaAction;
public function set MissingSchemaAction(MissingSchemaAction);

Property Value

One of the MissingSchemaAction values. The default is Add.

Implements

IDataAdapter.MissingSchemaAction

Exceptions

Exception Type Condition
ArgumentException The value set is not one of the MissingSchemaAction values.

Example

[Visual Basic, C#, C++] The following example creates a derived class, OleDbDataAdapter and sets some of its properties.

[Visual Basic] 
Public Sub CreateOleDbDataAdapter()
    Dim myDataAdapter As New OleDbDataAdapter()
    myDataAdapter.SelectCommand = _
       New OleDbCommand("SELECT * FROM Categories ORDER BY CategoryID")
    myDataAdapter.SelectCommand.Connection = New OleDbConnection _
       ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWIND_RW.MDB")
    myDataAdapter.MissingMappingAction = MissingMappingAction.Error
    myDataAdapter.MissingSchemaAction = MissingSchemaAction.Error
End Sub

[C#] 
public void CreateOleDbDataAdapter () {
   OleDbDataAdapter myDataAdapter = new OleDbDataAdapter();
   myDataAdapter.SelectCommand =
      new OleDbCommand("SELECT * FROM Categories ORDER BY CategoryID");
   myDataAdapter.SelectCommand.Connection =
      new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWIND_RW.MDB");
   myDataAdapter.MissingMappingAction = MissingMappingAction.Error;
   myDataAdapter.MissingSchemaAction = MissingSchemaAction.Error;
}

[C++] 
void CreateOleDbDataAdapter () {
   OleDbDataAdapter* myDataAdapter = new OleDbDataAdapter;
   myDataAdapter->SelectCommand =
      new OleDbCommand(S"SELECT * FROM Categories ORDER BY CategoryID");
   myDataAdapter->SelectCommand->Connection =
      new OleDbConnection(S"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWIND_RW.MDB");
   myDataAdapter->MissingMappingAction = MissingMappingAction::Error;
   myDataAdapter->MissingSchemaAction = MissingSchemaAction::Error;
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataAdapter Class | DataAdapter Members | System.Data.Common Namespace | MissingMappingAction

Show:
© 2014 Microsoft