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

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -