using .net to create add query layer(s) to a project?

Discussion created by msteinbrenner on Oct 12, 2012
i currently have projects that add a map layer from our sql server to a project and then join it to a table on the same sql server.

i am thinking that with query layers i could get around the two step process of first adding a layer and then joining to it by just defining and then adding query layers directly from within my .net project.

i am sure this is possible but haven't found any help in how to do it in my web searches.

would anyone have any code they could share to show how someone would use .net to define/add a query layer to an mxd?