LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 01-11-2006, 09:07 AM   #1
mrobertson
Member
 
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, 03:34 PM   #2
tekkieman
Member
 
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);
 
  


Reply


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 02:06 AM
xhost + as user oracle not working, need to see oracle install GUI enzo250gto Linux - Software 2 02-11-2007 12:27 PM
highlightling certain rows of a datagrid vb.net mrobertson Programming 7 08-11-2005 08:48 AM
Querying for data and porinting to a datagrid based on items in a list box mrobertson Programming 8 07-29-2005 02:23 PM
Oracle 9i client with Oracle 8i server ganninu Programming 1 02-19-2004 05:35 PM


All times are GMT -5. The time now is 03:46 AM.

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