OracleDataAdapter OracleDataAdapter OracleDataAdapter OracleDataAdapter Constructors

Definizione

Overload

OracleDataAdapter() OracleDataAdapter() OracleDataAdapter()

Inizializza una nuova istanza della classe OracleDataAdapter.Initializes a new instance of the OracleDataAdapter class.

OracleDataAdapter(OracleCommand) OracleDataAdapter(OracleCommand) OracleDataAdapter(OracleCommand) OracleDataAdapter(OracleCommand)

Inizializza una nuova istanza della classe OracleDataAdapter con l'istruzione SQL SELECT specificata.Initializes a new instance of the OracleDataAdapter class with the specified SQL SELECT statement.

OracleDataAdapter(String, OracleConnection) OracleDataAdapter(String, OracleConnection) OracleDataAdapter(String, OracleConnection) OracleDataAdapter(String, OracleConnection)

Inizializza una nuova istanza della classe OracleDataAdapter con un'istruzione SQL SELECT e una classe OracleConnection.Initializes a new instance of the OracleDataAdapter class with an SQL SELECT statement and an OracleConnection.

OracleDataAdapter(String, String) OracleDataAdapter(String, String) OracleDataAdapter(String, String) OracleDataAdapter(String, String)

Inizializza una nuova istanza della classe OracleDataAdapter con un'istruzione SQL SELECT e una stringa di connessione.Initializes a new instance of the OracleDataAdapter class with an SQL SELECT statement and a connection string.

OracleDataAdapter() OracleDataAdapter() OracleDataAdapter()

Inizializza una nuova istanza della classe OracleDataAdapter.Initializes a new instance of the OracleDataAdapter class.

public:
 OracleDataAdapter();
public OracleDataAdapter ();
Public Sub New ()

Esempi

Nell'esempio seguente viene creato OracleDataAdapter un oggetto e vengono impostate alcune delle relative proprietà.The following example creates an OracleDataAdapter and sets some of its properties.

Public Sub CreateOracleDataAdapter()  
    Dim myOracleConnection As OracleConnection = New OracleConnection("Data Source=Oracle8i;Integrated Security=yes")  
    Dim custDA As OracleDataAdapter = New OracleDataAdapter  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey  
  
    custDA.SelectCommand = New OracleCommand("SELECT DeptNo, DName FROM Dept", myOracleConnection)  
    custDA.InsertCommand = New OracleCommand("INSERT INTO Dept (DeptNo, DName) " & _  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection)  
    custDA.UpdateCommand = New OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " & _  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection)  
    custDA.DeleteCommand = New OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection)  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
End Sub  
public static void CreateOracleDataAdapter()   
{  
    OracleConnection myOracleConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes");  
    OracleDataAdapter custDA = new OracleDataAdapter();  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;  
  
    custDA.SelectCommand = new OracleCommand("SELECT DeptNo, CompanyName FROM Dept", myOracleConnection);  
    custDA.InsertCommand = new OracleCommand("INSERT INTO Dept (DeptNo, CompanyName) " +  
                                            "VALUES (:pDeptNo, :pCompanyName)", myOracleConnection);  
    custDA.UpdateCommand = new OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, CompanyName = :pCompanyName " +  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection);  
    custDA.DeleteCommand = new OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection);  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.InsertCommand.Parameters.Add("pCompanyName", OracleType.VarChar, 14, "CompanyName");  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.UpdateCommand.Parameters.Add("pCompanyName", OracleType.VarChar, 14, "CompanyName");  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
}  

Commenti

Quando si crea un'istanza di OracleDataAdapter, le proprietà di lettura/scrittura seguenti sono impostate sui rispettivi valori predefiniti, come illustrato nella tabella.When you create an instance of OracleDataAdapter, the following read/write properties are set to their default values, as shown in the table.

ProprietàProperties Valore predefinitoDefault value
MissingMappingAction MissingMappingAction.Passthrough
MissingSchemaAction MissingSchemaAction.Add

È possibile modificare il valore di una di queste proprietà tramite una chiamata separata alla proprietà.You can change the value of any of these properties through a separate call to the property.

Vedi anche

OracleDataAdapter(OracleCommand) OracleDataAdapter(OracleCommand) OracleDataAdapter(OracleCommand) OracleDataAdapter(OracleCommand)

Inizializza una nuova istanza della classe OracleDataAdapter con l'istruzione SQL SELECT specificata.Initializes a new instance of the OracleDataAdapter class with the specified SQL SELECT statement.

public:
 OracleDataAdapter(System::Data::OracleClient::OracleCommand ^ selectCommand);
public OracleDataAdapter (System.Data.OracleClient.OracleCommand selectCommand);
new System.Data.OracleClient.OracleDataAdapter : System.Data.OracleClient.OracleCommand -> System.Data.OracleClient.OracleDataAdapter
Public Sub New (selectCommand As OracleCommand)

Parametri

selectCommand
OracleCommand OracleCommand OracleCommand OracleCommand

Classe OracleCommand che è un'istruzione SQL SELECT o una stored procedure e viene impostata come la proprietà SelectCommand della classe OracleDataAdapter.An OracleCommand that is an SQL SELECT statement or stored procedure, and is set as the SelectCommand property of the OracleDataAdapter.

Esempi

Nell'esempio seguente viene creato OracleDataAdapter un oggetto e vengono impostate alcune delle relative proprietà.The following example creates an OracleDataAdapter and sets some of its properties.

Public Sub CreateOracleDataAdapter()  
    Dim myOracleConnection As OracleConnection = New OracleConnection("Data Source=Oracle8i;Integrated Security=yes")  
    Dim myOracleCommand As OracleCommand = New OracleCommand("SELECT DeptNo, DName FROM Dept", myOracleConnection)  
    Dim custDA As OracleDataAdapter = New OracleDataAdapter(myOracleCommand)  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey  
  
    custDA.InsertCommand = New OracleCommand("INSERT INTO Dept (DeptNo, DName) " & _  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection)  
    custDA.UpdateCommand = New OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " & _  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection)  
    custDA.DeleteCommand = New OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection)  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
End Sub  
public static void CreateOracleDataAdapter()   
{  
    OracleConnection myOracleConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes");  
    OracleCommand myOracleCommand = new OracleCommand("SELECT DeptNo, DName FROM Dept", myOracleConnection);  
    OracleDataAdapter custDA = new OracleDataAdapter(myOracleCommand);  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;  
  
    custDA.InsertCommand = new OracleCommand("INSERT INTO Dept (DeptNo, DName) " +  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection);  
    custDA.UpdateCommand = new OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " +  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection);  
    custDA.DeleteCommand = new OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection);  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName");  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName");  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
}  

Commenti

Questa implementazione del OracleDataAdapter costruttore imposta la SelectCommand proprietà sul valore specificato nel selectCommand parametro.This implementation of the OracleDataAdapter constructor sets the SelectCommand property to the value specified in the selectCommand parameter.

Quando si crea un'istanza di OracleDataAdapter, le proprietà di lettura/scrittura seguenti sono impostate sui rispettivi valori predefiniti, come illustrato nella tabella.When you create an instance of OracleDataAdapter, the following read/write properties are set to their default values, as shown in the table.

ProprietàProperties Valore inizialeInitial value
MissingMappingAction MissingMappingAction.Passthrough
MissingSchemaAction MissingSchemaAction.Add

È possibile modificare il valore di una di queste proprietà tramite una chiamata separata alla proprietà.You can change the value of any of these properties through a separate call to the property.

Vedi anche

OracleDataAdapter(String, OracleConnection) OracleDataAdapter(String, OracleConnection) OracleDataAdapter(String, OracleConnection) OracleDataAdapter(String, OracleConnection)

Inizializza una nuova istanza della classe OracleDataAdapter con un'istruzione SQL SELECT e una classe OracleConnection.Initializes a new instance of the OracleDataAdapter class with an SQL SELECT statement and an OracleConnection.

public:
 OracleDataAdapter(System::String ^ selectCommandText, System::Data::OracleClient::OracleConnection ^ selectConnection);
public OracleDataAdapter (string selectCommandText, System.Data.OracleClient.OracleConnection selectConnection);
new System.Data.OracleClient.OracleDataAdapter : string * System.Data.OracleClient.OracleConnection -> System.Data.OracleClient.OracleDataAdapter
Public Sub New (selectCommandText As String, selectConnection As OracleConnection)

Parametri

selectCommandText
String String String String

Stringa che è un'istruzione SQL SELECT o una stored procedure, utilizzata dalla proprietà SelectCommand della classe OracleDataAdapter.A string that is an SQL SELECT statement or stored procedure to be used by the SelectCommand property of the OracleDataAdapter.

selectConnection
OracleConnection OracleConnection OracleConnection OracleConnection

Classe OracleConnection che rappresenta la connessione.An OracleConnection that represents the connection.

Esempi

Nell'esempio seguente viene creato OracleDataAdapter un oggetto e vengono impostate alcune delle relative proprietà.The following example creates an OracleDataAdapter and sets some of its properties.

Public Sub CreateOracleDataAdapter()  
    Dim myOracleConnection As OracleConnection = New OracleConnection("Data Source=Oracle8i;Integrated Security=yes")  
    Dim mySelectText As String = "SELECT DeptNo, DName FROM Dept"  
    Dim custDA As OracleDataAdapter = New OracleDataAdapter(mySelectText, myOracleConnection)   
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey  
  
    custDA.InsertCommand = New OracleCommand("INSERT INTO Dept (DeptNo, DName) " & _  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection)  
    custDA.UpdateCommand = New OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " & _  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection)  
    custDA.DeleteCommand = New OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection)  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
End Sub  
public static void CreateOracleDataAdapter()   
{  
    OracleConnection myOracleConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes");  
  
    string mySelectText = "SELECT DeptNo, DName FROM Dept";  
  
    OracleDataAdapter custDA = new OracleDataAdapter(mySelectText, myOracleConnection );  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;  
  
    custDA.InsertCommand = new OracleCommand("INSERT INTO Dept (DeptNo, DName) " +  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection);  
    custDA.UpdateCommand = new OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " +  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection);  
    custDA.DeleteCommand = new OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection);  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName");  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName");  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
}  

Commenti

Questa implementazione di OracleDataAdapter può essere utile in un'applicazione che deve chiamare il Fill metodo per due o più OracleDataAdapter oggetti.This implementation of the OracleDataAdapter can be useful in an application that must call the Fill method for two or more OracleDataAdapter objects.

Vedi anche

OracleDataAdapter(String, String) OracleDataAdapter(String, String) OracleDataAdapter(String, String) OracleDataAdapter(String, String)

Inizializza una nuova istanza della classe OracleDataAdapter con un'istruzione SQL SELECT e una stringa di connessione.Initializes a new instance of the OracleDataAdapter class with an SQL SELECT statement and a connection string.

public:
 OracleDataAdapter(System::String ^ selectCommandText, System::String ^ selectConnectionString);
public OracleDataAdapter (string selectCommandText, string selectConnectionString);
new System.Data.OracleClient.OracleDataAdapter : string * string -> System.Data.OracleClient.OracleDataAdapter
Public Sub New (selectCommandText As String, selectConnectionString As String)

Parametri

selectCommandText
String String String String

Stringa che è un'istruzione SQL SELECT o una stored procedure, utilizzata dalla proprietà SelectCommand della classe OracleDataAdapter.A string that is an SQL SELECT statement or stored procedure to be used by the SelectCommand property of the OracleDataAdapter.

selectConnectionString
String String String String

Stringa di connessione.The connection string.

Esempi

Nell'esempio seguente viene creato OracleDataAdapter un oggetto e vengono impostate alcune delle relative proprietà.The following example creates an OracleDataAdapter and sets some of its properties.

Public Sub CreateOracleDataAdapter()  
    Dim myConnectionText As String = "Data Source=Oracle8i;Integrated Security=yes"  
    Dim mySelectText As String = "SELECT DeptNo, DName FROM Dept"  
    Dim custDA As OracleDataAdapter = New OracleDataAdapter(mySelectText, myConnectionText )   
    Dim myOracleConnection As OracleConnection = custDA.SelectCommand.Connection  
  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey     
  
    custDA.InsertCommand = New OracleCommand("INSERT INTO Dept (DeptNo, DName) " & _  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection)  
    custDA.UpdateCommand = New OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " & _  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection)  
    custDA.DeleteCommand = New OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection)  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName")  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original  
End Sub  
public static void CreateOracleDataAdapter()   
{  
    string myConnectionText = "Data Source=Oracle8i;Integrated Security=yes";  
  
    string mySelectText = "SELECT DeptNo, DName FROM Dept";  
  
    OracleDataAdapter custDA = new OracleDataAdapter(mySelectText, myConnectionText );  
   OracleConnection myOracleConnection = custDA.SelectCommand.Connection;  
  
    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;  
  
    custDA.InsertCommand = new OracleCommand("INSERT INTO Dept (DeptNo, DName) " +  
                                            "VALUES (:pDeptNo, :pDName)", myOracleConnection);  
    custDA.UpdateCommand = new OracleCommand("UPDATE Dept SET DeptNo = :pDeptNo, DName = :pDName " +  
                                            "WHERE DeptNo = :pDeptNo", myOracleConnection);  
    custDA.DeleteCommand = new OracleCommand("DELETE FROM Dept WHERE DeptNo = :pDeptNo", myOracleConnection);  
  
    custDA.InsertCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.InsertCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName");  
  
    custDA.UpdateCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo");  
    custDA.UpdateCommand.Parameters.Add("pDName", OracleType.VarChar, 14, "DName");  
    custDA.UpdateCommand.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
  
    custDA.DeleteCommand.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo").SourceVersion = DataRowVersion.Original;  
}  
Vedi anche

Si applica a