Will this LINQ-TO-SQL query fetch all records from the table ?
- by Puneet Dudeja
public long GetNewCRN()
{
return ((from c in DataContext.GetTable<Cust_Master>()
select c.CUSTSERH_CRN).Max() + 1);
}
Will this Linq to Sql query fetch all records from the table first and then select the maximum of the column ?
If yes, then isn't it a bad idea using linq to sql instead of normal SqlCommand ?
Or is there any other way of doing it in linq to sql ?
When I attach Console.Out, I see nothing(command prompt does not even open).
But when I include following:-
context.Log = new System.IO.StreamWriter("d:\\abcd.txt");
I get an error, that "The process can not access the file because it is being used by another process" and that process is "w3wp.exe".
How can I see the sql commands being executed by DataContext then ?