Reviews
ODP.NETTable of Contents
ODP.NET - Retrieving Multiple Rows on to the Grid
Pulling Information Using Table NamePulling Information Using Table Name
ODP.NET - Retrieving Multiple Rows on to the Grid
Pulling Information Using Table Name
In all of the previous examples, the SELECT statement was used to retrieve a set of rows. The SELECT statement is a good choice if you would like to retrieve only specific columns or to include some complex combinations using sub-queries, joins etc.
You can also retrieve a complete table (without using a SELECT statement) by setting the CommandType of OracleCommand to TableDirect. The following code demonstrates the use of TableDirect:
- Imports Oracle.DataAccess.Client
- Public Class Form2
- Private Sub btnGetEmployees_Click(ByVal sender As
- System.Object, ByVal e As System.EventArgs) Handles
- btnGetEmployees.Click
- 'create connection to db
- Dim cn As New OracleConnection("Data Source=xe; _
- User Id=scott;Password=tiger")
- Try
- Dim SQL As String
- 'build the SELECT statement
- Dim cmd As New OracleCommand("emp", cn)
- cmd.CommandType = CommandType.TableDirect
- cmd.Connection.Open()
- ...
- End Sub
- End Class
The default CommandType is Text, which accepts any SQL statement. When we change it to TableDirect, it accepts only a table name. Another command type available is StoredProcedure. It is mainly used when you want to execute stored procedures using an OracleCommand object. (Working with PL/SQL stored procedures is covered in Chapter 5.)
ODP.NET
- Getting Started with Oracle and ODP.NET
- ODP.NET - Fundamental ODP.NET Classes to Retrieve Data
- ODP.NET - Retrieving Data Using OracleDataReader
- ODP.NET - Retrieving Multiple Rows on to the Grid
- ODP.NET - Retrieving Typed Data
- ODP.NET - Filling a DataTable Using OracleDataReader
- ODP.NET Retrieving a Single Row of Information Using OracleDataAdapter
- ODP.NET - Retrieving a Single Row of Information Using OracleDataAdapter
- ODP.NET - Working with DataTableReader
- ODP.NET - Populating a Dataset with a Single Data Table
- ODP.NET - Populating a Dataset with Multiple Data Tables
- ODP.NET - Presenting Master-Detail Information Using a Dataset
- ODP.NET - OracleCommand Object
- ODP.NET - Handling Nulls when Executing with ExecuteScalar
- ODP.NET - Handling Nulls when Working with OracleDataReader
- ODP.NET - Working with Bind Variables together with OracleParameter
- ODP.NET - Working with OracleDataAdapter with OracleCommand
- ODP.NET - Techniques to Improve Performance while Retrieving Data







