PC Review


Reply
Thread Tools Rate Thread

Code for retrieving/updating data in Oracle database using ASP.NET

 
 
=?Utf-8?B?Q2hhbmRydQ==?=
Guest
Posts: n/a
 
      28th Jun 2005
Can anyone help me out from the above by giving a code snippnet including the
import namespace directives.

Regards/CS
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2hhaSBHb2xkYmVyZw==?=
Guest
Posts: n/a
 
      29th Jun 2005
Each code snippnet that is valid for retrieving data from SQLClient should
work but with changing the import to be OracleClient.
Notice that Oracle client should be added to the References node in the
Solution Explorer prior to trying to use it.

--
Shai

"Chandru" wrote:

> Can anyone help me out from the above by giving a code snippnet including the
> import namespace directives.
>
> Regards/CS

 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      29th Jun 2005
On Tue, 28 Jun 2005 07:20:03 -0700, "Chandru" <(E-Mail Removed)> wrote:

¤ Can anyone help me out from the above by giving a code snippnet including the
¤ import namespace directives.
¤

You need to add a reference (Project..Add Reference) to the System.Data.OracleClient.dll assembly.

Below is a code snippet that uses the DataReader and DataAdapter:

Dim ConnectionString As String

ConnectionString = "DATA SOURCE=Server;USER ID=userid;PASSWORD=password"

Dim ConnectionOracle As New System.Data.OracleClient.OracleConnection(ConnectionString)
ConnectionOracle.Open()

'**************** Start Data Reader Code ****************

Dim OracleCommand As New System.Data.OracleClient.OracleCommand
OracleCommand.Connection = ConnectionOracle
OracleCommand.CommandText = "Select * from TableName"
OracleCommand.CommandType = CommandType.Text

Dim DataReaderOracle As System.Data.OracleClient.OracleDataReader
DataReaderOracle = OracleCommand.ExecuteReader()

While (DataReaderOracle.Read())
Console.WriteLine(DataReaderOracle.Item(0).ToString)
Console.WriteLine(DataReaderOracle.Item(1).ToString)
End While

DataReaderOracle.Close()

'**************** End Data Reader Code ****************

'**************** Start Data Adapter Code ****************
Dim DataAdapterOracle As New System.Data.OracleClient.OracleDataAdapter("Select * from
TableName", ConnectionOracle)

Dim DataSetOracle As New DataSet("OracleTables")

DataAdapterOracle.Fill(DataSetOracle, "TableName")

Dim DataTableOracle As DataTable
DataTableOracle = DataSetOracle.Tables("TableName")

Dim RowCurrent As DataRow
For Each RowCurrent In DataTableOracle.Rows
Console.WriteLine("{0} {1}", _
RowCurrent(0).ToString, _
RowCurrent(1).ToString)
Next
'**************** End Data Adapter Code ****************

ConnectionOracle.Close()

End Sub


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code a button and Macro to Insert data to an Oracle Database =?Utf-8?B?QklfR3V5?= Microsoft Excel Programming 0 6th Jul 2007 06:50 PM
display data from Oracle database with another code page Mrozik Microsoft ADO .NET 0 2nd Aug 2005 12:02 PM
Access VBA Code Updating Oracle Table! =?Utf-8?B?YXA=?= Microsoft Access VBA Modules 1 16th Jan 2004 10:21 PM
Need help retrieving data from an Oracle db drswanker Microsoft Excel Misc 0 9th Dec 2003 02:37 PM
Retrieving data from Oracle drswanker Microsoft Excel Programming 0 8th Dec 2003 07:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:20 AM.