Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ASP and ADO Gotcha - Duplicate Field Names in a Query


ASP and ADO Gotcha - Duplicate Field Names in a Query

Author
Message
Leon Platt
Leon Platt
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 1
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/lplatt/aspandadogotchaduplicatefieldnamesinaquery.asp



mmaslanik
mmaslanik
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
That's wonderful, but what is the solution?



GRN
GRN
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 1
use a alias i suppose !!



robiwon
robiwon
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
Is this article for real? You must be very new to ADO programming to just be hitting this.



Leon Platt
Leon Platt
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 1
quote:
Is this article for real? You must be very new to ADO programming to just be hitting this.
That would be an incorrect assumption but thanks for the feedback anyway. The thing is, I probably never would have run across this if it wasn't for the cut and paste programming I happend to be doing at the time. Typically I would have written the sql statement by hand in which case I would have aliased the fields accordingly. Yes GRN - you are correct
quote:
use a alias i suppose !!
Although there are several solutions to this problem the best is to alias the rating as "Article Rating" and "Book Rating", thus no ambiguity. The purpose of this Tip was not to uncover some deep dark secret of ADO but rather to give other programmers something to think about when creating sql statements that return record sets in ADO.



Andy Warren
Andy Warren
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: Moderators
Points: 7231 Visits: 2679
I agree with Leon that this isn't so much about ADO as it is best practices. If you're aliasing your tables and cols correctly, you'll never see this. Just out of curiousity, can anyone tell me if this is a bug or a feature of ADO?

Andy

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
BobAtDBS
BobAtDBS
Old Hand
Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)

Group: General Forum Members
Points: 304 Visits: 357
Once the Join is done, there are no P. and A. qualifiers anymore. You simply have to alias the fieldnames to something meaningful. I suppose it's considered a 'feature' since many times the identically named fields would have identical data (but then why return both?).


Student of SQL and Golf, Master of Neither
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search