Aracılığıyla paylaş


OracleDataAdapter Oluşturucular

Tanım

OracleDataAdapter sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

OracleDataAdapter()

OracleDataAdapter sınıfının yeni bir örneğini başlatır.

OracleDataAdapter(OracleCommand)

Belirtilen SQL SELECT deyimiyle sınıfının yeni bir örneğini OracleDataAdapter başlatır.

OracleDataAdapter(String, OracleConnection)

SQL SELECT deyimi ve OracleConnectionile sınıfının yeni bir örneğini OracleDataAdapter başlatır.

OracleDataAdapter(String, String)

SQL SELECT deyimi ve bağlantı dizesi ile sınıfının yeni bir örneğini OracleDataAdapter başlatır.

OracleDataAdapter()

OracleDataAdapter sınıfının yeni bir örneğini başlatır.

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

Örnekler

Aşağıdaki örnek bir OracleDataAdapter oluşturur ve bazı özelliklerini ayarlar.

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

Açıklamalar

örneğini OracleDataAdapteroluşturduğunuzda, aşağıdaki okuma/yazma özellikleri tabloda gösterildiği gibi varsayılan değerlerine ayarlanır.

Özellikler Varsayılan değer
MissingMappingAction MissingMappingAction.Passthrough
MissingSchemaAction MissingSchemaAction.Add

Özelliğine ayrı bir çağrı aracılığıyla bu özelliklerden herhangi birinin değerini değiştirebilirsiniz.

Ayrıca bkz.

Şunlara uygulanır

OracleDataAdapter(OracleCommand)

Belirtilen SQL SELECT deyimiyle sınıfının yeni bir örneğini OracleDataAdapter başlatır.

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)

Parametreler

selectCommand
OracleCommand

SQL OracleCommand SELECT deyimi veya saklı yordam olan ve özelliği OracleDataAdapterolarak SelectCommand ayarlanan.

Örnekler

Aşağıdaki örnek bir OracleDataAdapter oluşturur ve bazı özelliklerini ayarlar.

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

Açıklamalar

Oluşturucunun OracleDataAdapter bu uygulaması, özelliğini parametresinde belirtilen değere selectCommand ayarlarSelectCommand.

örneğini OracleDataAdapteroluşturduğunuzda, aşağıdaki okuma/yazma özellikleri tabloda gösterildiği gibi varsayılan değerlerine ayarlanır.

Özellikler İlk değer
MissingMappingAction MissingMappingAction.Passthrough
MissingSchemaAction MissingSchemaAction.Add

Özelliğine ayrı bir çağrı aracılığıyla bu özelliklerden herhangi birinin değerini değiştirebilirsiniz.

Ayrıca bkz.

Şunlara uygulanır

OracleDataAdapter(String, OracleConnection)

SQL SELECT deyimi ve OracleConnectionile sınıfının yeni bir örneğini OracleDataAdapter başlatır.

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)

Parametreler

selectCommandText
String

özelliği OracleDataAdaptertarafından SelectCommand kullanılacak bir SQL SELECT deyimi veya saklı yordam olan bir dize.

selectConnection
OracleConnection

OracleConnection Bağlantıyı temsil eden bir.

Örnekler

Aşağıdaki örnek bir OracleDataAdapter oluşturur ve bazı özelliklerini ayarlar.

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

Açıklamalar

bu OracleDataAdapter uygulaması, iki veya daha fazla OracleDataAdapter nesne için yöntemini çağırması Fill gereken bir uygulamada yararlı olabilir.

Ayrıca bkz.

Şunlara uygulanır

OracleDataAdapter(String, String)

SQL SELECT deyimi ve bağlantı dizesi ile sınıfının yeni bir örneğini OracleDataAdapter başlatır.

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)

Parametreler

selectCommandText
String

özelliği OracleDataAdaptertarafından SelectCommand kullanılacak bir SQL SELECT deyimi veya saklı yordam olan bir dize.

selectConnectionString
String

Bağlantı dizesi.

Örnekler

Aşağıdaki örnek bir OracleDataAdapter oluşturur ve bazı özelliklerini ayarlar.

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

Ayrıca bkz.

Şunlara uygulanır