2010-03-02 75 views

回答

1

因爲您不能在select語句中調用存儲過程。

你的命令在tsql中看起來像這樣...但這是無效的。

select b.Id 
    from aTable a 
    inner join (exec SomeStoredProcedure) b on a.Id = b.Id 

如果您使用的是udf而不是存儲過程,則LINQ語句將起作用。或者,您可以在加入之前執行存儲過程。

var foo = (from a in aTable 
    from b in this.SomeStoredProcedure().ToList() 
    where a.Id == b.Id 
    select b.Id);