Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-11-2006, 08:07 AM   #1
Registered: May 2005
Posts: 275

Rep: Reputation: 30
Displaying an oracle dataset on a datagrid using C#

I am trying to write a simple C# Program that uses a connection to oracle to populate a dataset and display the dataset onto a dtatgrid. Here is what I have so far:

string connectionString = "Data Source=DUF_TCM;User ID=PCC;Password=DUFERCO";
string sql = "SELECT grade_code FROM tcm_reported_coil@L3";

OracleConnection dbcon = null;
dbcon.Open ();

dgQueryResults.SetDataBinding(coilDataSet, "Table1");
DataTable t = coilDataSet.Tables["Table1"];

coilDataSet = new DataSet();
dbcon = new OracleConnection(connectionString);

adapter = new OracleDataAdapter();
//OracleCommand dbcmd = dbcon.CreateCommand ();
OracleCommand cmd1 = OracleCommand("",connectionString);
cmd1.CommandText = sql;
adapter.SelectCommand = cmd1;//new OracleCommand(sql, connectionString);
adapter.Fill(coilDataSet, "Table1");

I am getting the following error on the bold faced line:
'System.Data.OracleClient.OracleCommand' denotes a 'class' which is not valid in the given context.

Can somebody help me with what I need to do to fix this or any changes or additions that need to be made?
Old 01-11-2006, 02:34 PM   #2
Registered: Dec 2004
Location: Northern CA
Distribution: Mepis 6.5
Posts: 123

Rep: Reputation: 15
Just a quick guess, but I think the line:

OracleCommand cmd1 = OracleCommand("",connectionString);

should be:

OracleCommand cmd1 = new OracleCommand("", connectionString);


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between Oracle Server and Oracle Database ganninu Programming 3 02-27-2007 01:06 AM
xhost + as user oracle not working, need to see oracle install GUI enzo250gto Linux - Software 2 02-11-2007 11:27 AM
highlightling certain rows of a datagrid mrobertson Programming 7 08-11-2005 07:48 AM
Querying for data and porinting to a datagrid based on items in a list box mrobertson Programming 8 07-29-2005 01:23 PM
Oracle 9i client with Oracle 8i server ganninu Programming 1 02-19-2004 04:35 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration