开发者

How to Get A Joined Query to List Object

I have a dynamic sql query which contains more than one table joined. Normally I get this query to a datatable and use it. For now I want to get result of thi开发者_JS百科s query to a list object. Does anyone help me about this case?


You'll have to loop through the rows of the datatable, populate the column values to the properties of an object, add the object to the list and then return the list. Alternatively you could consider using a ORM tool like NHibernate.


If this query does not change very much you could create a stored procedure from it and implement the stored procedure in the Linq2SQL designer. This would give you the ability to just write

var MyResult = context.spMyStoredProcedure(var1, var2);

If I'm not completely wrong... Writing from memory ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜