2010-04-07 77 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());