views:

161

answers:

3

If i do a select on user.name, user.post, t.name with t being tag_name AS t is there a way to resolve the full name using ADO.NET?

I found SqlDataReader.GetName but that is getting me only name as the first result. I would like to know if it belongs to user or tag_name. Is there a way to have it tell me?

+2  A: 

By the time the results get back to ado.net, the original source table of the fields are gone - all you have are the field names.

Ray
+1  A: 

Ray is correct in that ado.net doesn't give you this. What I have done in the past is to get the SQL from the stored procedure or view and do some string manipulation to work this out.

rip
+2  A: 

You could alias your field with the table name as a prefix and read the fieldname and manipulate it in the client..

select a.column1 as [users column1],b.column2 as [tag_name column2] from users a     left join tag_name b on a.col = b.col blah blah....
Richard Friend
hmm, interesting. +1
acidzombie24