Friday, November 12, 2010

Linq 多項 OrderBy...

Var movies = _db.Movies.Orderby(c => c.Category).ThenBy(n => n.Name)

不同sql...原來用ThenBy

還可以
var movies = from row in _db.Movies  orderby row.Category, row.Name select row;

Monday, November 1, 2010

OptimisticConcurrencyException

C兄教的...
處理save入db時出現concurrency的問題...
記低先...
                           
try
{
    int Indict = db.SaveChanges();
}
    catch (OptimisticConcurrencyException)
{
    db.Refresh(System.Data.Objects.RefreshMode.ClientWins, add);
    db.SaveChanges();
}

Saturday, October 30, 2010

I find that it is really so stupid to type so much about a tech news, all details of it are in its site...

Name:
box.net - free online storage space provide 1GB space for free users

Why mention this: 1. It is new
2. More friendly to cloud compare with other file storage service
3. More friendly with Google Apps & Android
4. Can Embed File download panel to webpage


http://www.box.net/home

Wednesday, October 27, 2010

What is the different between .toSting & Convert.ToString() ?

In short, almost no different
as the runtime of them is very close (but in fact, .toString is a little bit fast then Convert.ToString())
btw, Convert.ToString() can handle null value while .toSting can not (it will return Error)