c# - .net - get all records from table and loop through -


i'm trying records table , loop through it.

pseudo code:

database.dbdatacontext db = new database.dbdatacontext();  protected void page_load(object sender, eventargs e) {      list<database.user> data = db.users.tolist();      // rows     (int = 0; < data.count; i++)     {         // columns         (int j = 0; j < data[i].count; j++)         {          }     }  } 

i'm unsure syntax.

anyone know how that?

thanks in advance!

why not that:

database.dbdatacontext db = new database.dbdatacontext();  protected void page_load(object sender, eventargs e) {     foreach(database.user user in db.users)     {        // whatever need `user` object here.....        // here, have instance of `user` object - access properties        // , methods on `user` object....     } } 

Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -