2010-04-07 55 views

回答

1

如果您在C#代码中有Linq-to-SQL查询,只需调试到​​您的应用程序并将鼠标悬停在接受结果的变量上 - 您应该能够检查该Linq使用的实际SQL到SQL查询。

alt text http://i42.tinypic.com/okudf7.png

查看原图图像:http://tinypic.com/view.php?pic=okudf7&s=5

+1

你可以看到LINQ查询可视化工具的更多详细信息:http://msdn.microsoft.com/en -us /库/ bb629285.aspx – Giorgi 2010-04-07 17:43:06

1

调用查询的ToString()方法。

只要ResultSet是IQueryable<T>的ToString()方法将输出查询:

dbDataContext db = new dbDataContext(); 

var query = from c in db.Customers 
        where c.Name == "foo" 
        select c; 

Response.Write(query.ToString());