Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle 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
Old December 17th, 2003, 11:03 AM
Authorized User
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Returning resultset to ADO.NET dataset

I am encountering a strange problem when trying to return the results of a simple 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;


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?

Many Thanks,
Old December 19th, 2003, 01:33 PM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Did you instantiate the OracleCommand?
oraCmd = new OracleCommand();
oraCmd = new OracleCommand(sql, conn);
where conn is your connection.


Old December 22nd, 2003, 10:28 AM
Registered User
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Yep ...

Your problem is the semi-colon ';' at the end of the statement. Drop this and all will be well!:)

Old December 22nd, 2003, 10:44 AM
Authorized User
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts


Similar Threads
Thread Thread Starter Forum Replies Last Post
ADO.NET dataset with join divinyl Crystal Reports 4 January 26th, 2006 03:12 AM
Problems With returning records through ADO marko_one Classic ASP Databases 5 September 30th, 2004 04:06 AM
ADO.NET Dataset Questions winnie1778 ADO.NET 1 October 20th, 2003 12:50 PM
ADO.NET Dataset winnie1778 Crystal Reports 0 October 17th, 2003 04:44 AM

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