Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 November 14th, 2007, 09:20 AM
Registered User
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# with Oracle


After joining two or more tables i am getting repeatative column name. GetOrdinal("Column Name") in c# always returns the ordinal of 1st column name encountered. suggest me a way of doing this.

 
Old November 14th, 2007, 09:24 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Usually GetOridinal("TableName.ColumnName") is the way to go. If your column or table names contain spaces then don't forget to enclose them in delimiters. In SQL Server this is "[Table Name].[Column Name]" but I think in Oracle its "'Table Name'.'Column Name'".

/- Sam Judson : Wrox Technical Editor -/
 
Old November 14th, 2007, 11:46 PM
Registered User
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no, in oracle also its GetOrdinal("Column Name"). its not GetOrdinal["TableName.ColumnName"). even the "'Table Name'.'Column Name'" is throwing same error.

System.IndexOutOfRangeException:

 
Old November 15th, 2007, 01:46 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use aliases for your duplicate column names

Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems
 
Old November 15th, 2007, 04:56 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Another alternative is of course to run the sql in toad (or whatever oracle editor you might be using) and see what column names it gives you, or run it in .net and loop through each column outputting the column name.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle SOA, BPEL and Oracle worklist umeshtheone Pro Java 1 April 16th, 2008 11:01 PM
call oracle function using oracle link server vl SQL Server 2000 1 July 12th, 2007 08:19 AM
How to Read Oracle Data without Oracle being insta badrinarayanang Oracle 1 October 6th, 2005 06:34 AM
Connecting to Oracle without Oracle Client mahaveerar VB Databases Basics 0 February 22nd, 2005 05:18 PM
Connecting to Oracle without Oracle Client mahaveerar Excel VBA 0 February 22nd, 2005 03:55 PM





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