Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 17th, 2003, 11:08 AM
Authorized User
 
Join Date: Nov 2003
Location: , , United Kingdom.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Returning Oracle SELECT query results to DataSet

I am encountering a strange problem when trying to return the results of a simple Oracle SELECT query to an ADO.NET recordset. I can do this without problems with a stored procedure, it is only when I use a "hard-coded" SELECT statement that I get issues. I need to do this because some of my SQL is dynamically generated.

Example code is as follows:-

OracleCommand oraCmd;
OracleDataAdapter oraDa;
System.Data.DataSet ds;

sql = "SELECT * FROM TBLSUBJECTS;";

oraCmd.CommandType = CommandType.Text;
oraCmd.CommandText = sql;

ds = new DataSet();
oraDa = new OracleDataAdapter(oraCmd);
oraDa.Fill(ds, scrTable);

...when the .Fill() method executes, I get the following error returned from Oracle:-

"ORA-01036: illegal variable name/number"

Can anyone tell me what I am doing wrong? Do I need to declare a RefCursor and return the results through that? I am using Oracle 9i.

Many Thanks,
Gary




Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL returning odd results jakeone SQL Language 1 November 13th, 2006 05:07 AM
Returning the 1st row of a SELECT Sub Query rit01 SQL Server 2000 2 February 21st, 2006 12:20 PM
Temp Table Query not returning results to page rlull SQL Server 2000 1 November 15th, 2005 04:50 PM
Query returning 0 results although SQL is valid aquagal77 Classic ASP Databases 4 March 31st, 2005 11:06 AM
Query not returning correct results from database Jams30 PHP Databases 5 November 7th, 2003 08:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.