I have a table called Quotes in linq-to-sql that contains 2 columns: author and quote. How do you select both columns of a random row?
1 First create a class with rend property
public class tbl_EmpJobDetailsEntity
{
public int JpId { get; set; }
public int rend
{
get
{
Random rnd = new Random();
return rnd.Next(1, 100);
}
}
}
2 Linq query
var rendomise = (from v in db.tbl_EmpJobDetails
select new tbl_EmpJobDetailsEntity
{
JpId=v.JpId
}).OrderBy(o=>o.rend);