I have two tables that I want to join and use to fill a data table, and I am having an issue with column name collision:
----------- -----------
| Parent | | Child |
----------- -----------
| ParentID| | ChildID |
| Name | | ParentID|
| Value | | Name |
----------- | Value |
-----------
The SQL statement (MySQL database, in case it's relevant)
select p.*, c.* from parent p left join child c on c.ParentID = c.ChildID
My adapter code (C#):
var adapter = new MySqlDataAdapter(sql, DBConn);
adapter.Fill(table);
When I go to read the rows, i expect something like this:
var parentName = row["p.Name"];
var childName = row["c.Name"];
Instead, it is resulting in this:
var parentName = row["Name"];
var childName = row["Name1"];
How do i get the column names to use the aliases? I feel like I am missing something obvious, because this seems like it should come up all the time.