| Devart.Data.Oracle Namespace : OracleDataTable Class |
Represents a single object that provides all of the functionality needed to retrieve and manipulate data from an Oracle data source.
For a list of all members of this type, see OracleDataTable members.
Devart.Common.DbDataTable
Devart.Data.Oracle.OracleDataTable
[Visual Basic]
Public Class OracleDataTable
Inherits DbDataTable
Implements IComponent , IListSource , ISupportInitialize , ISupportInitializeNotification , ITypedList , IDisposable , IServiceProvider , ISerializable , IXmlSerializable [C#]
public class OracleDataTable : DbDataTable, IComponent , IListSource , ISupportInitialize , ISupportInitializeNotification , ITypedList , IDisposable , IServiceProvider , ISerializable , IXmlSerializable The OracleDataTable class extends the Devart.Common.DbDataTable class to provide a single object that can be used to access and update data from a data source. Actually, OracleDataTable replaces OracleConnection, OracleCommand, OracleDataAdapter, and OracleCommandBuilder classes with all-in-one class. When a OracleDataTable object is created, the default values of its constituent parts are set to reasonable defaults, meaning that the programmer can create a single object and immediately use it to retrieve and manipulate data from a data source.
By using OracleDataTable you can avoid explicit creation of OracleConnection and OracleCommand objects. When appropriate form of constructor is used, these objects are created automatically when you retrieve data from a data source. It allows you to cut down the size of the written code.
OracleDataTable allows you to automate loading of subsets of data either by selecting StartRecord and Devart.Common.DbDataTable.MaxRecords properties or by using Devart.Common.DbDataTable.Fill or Devart.Common.DbDataTable.FillPage methods that support passing parameter values into the query text.
The OracleDataTable class is designed to employ both connected and disconnected data access models. It also provides functionality for asynchronous fill operations.
The OracleDataTable class can be fully adjusted at design-time. You may retrieve data at design-time from a data source by setting Active property to true.
For more information on advanced features of OracleDataTable please refer to topic OracleDataTable Advanced Features.
This class supports cross-form data binding with the InterForm Technology.
This class is available only in Professional and Developer Editions. It is not available in Standard and Mobile Editions.
ExecutePageReader method puts on following restrictions on the executable statement:
- you cannot execute stored procedures and PL/SQL blocks;
- you may specify only SQL statement that can be placed into the subquery.
To use ExecutePageReader method it is recommended to optimize a query for retrieving a first row, otherwise using this method is ineffective.
Note that OracleDataTable supports advanced data binding for such Oracle objects as nested tables, varrays, and Oracle objects. Use DataSource and DataMember properties of DataGrid to render OracleTable, OracleArray, and OracleObject objects.
This sample shows easiness of use of OracleDataTable. The sample creates a OracleDataTable object, passing it SQL query text and connection string, retrieves data from a table and modifies it. Content of the table is printed to console then. Notice that no other component needs to be created by programmer.
[C#]
public void UseDataTable()
{
OracleDataTable myDataTable = new OracleDataTable("SELECT * FROM Test.Dept",
"User Id=Scott;Password=tiger;Data Source=Ora");
try
{
myDataTable.FetchAll = true;
myDataTable.Active = true;
myDataTable.Rows[3]["DName"] = "Researches";
Console.WriteLine(myDataTable.Update()+" rows updated.");
foreach(DataRow myRow in myDataTable.Rows)
{
foreach(DataColumn myCol in myDataTable.Columns)
{
Console.Write(myRow[myCol]+"\t");
}
Console.WriteLine();
}
}
finally
{
myDataTable.Active = false;
}
} [Visual Basic]
Public Sub UseDataTable()
Dim myDataTable As OracleDataTable = New OracleDataTable("SELECT * FROM Test.Dept", _
"User Id=Scott;Password=tiger;Data Source=Ora")
Try
myDataTable.FetchAll = True
myDataTable.Active = True
myDataTable.Rows(3)("DName") = "Researches"
Console.WriteLine(myDataTable.Update() & " rows updated.")
Dim myRow As DataRow
Dim myCol As DataColumn
For Each myRow In myDataTable.Rows
For Each myCol In myDataTable.Columns
Console.Write(myRow(myCol) & Chr(9))
Next myCol
Console.WriteLine()
Next myRow
Finally
myDataTable.Active = False
End Try
End SubOracleDataTable Members | Devart.Data.Oracle Namespace | OracleConnection Class | OracleDataReader Class
© 2002 - 2013 Devart. All Rights Reserved.