Sign in | Join
Last post 05-11-2009 8:23 AM by kavita_khandhadia. 6 replies.
Sort Posts: Oldest to newest Newest to oldest
Hello all,
I like to bind the grid using collection concept(Not Dataset)....
In these conecpts how can i get the data from the database, and insert into collections and bind the grid..
Plz send the sample code
which one gives the best performance ??(Dataset or Collection)
and Why??
Well i think... dataset it self is a colletion of datatables.. and data tables are collection of rows.. so ultimately Dataset is collection of collections....
now in oppose to this u are tokin about which collection? there can be so many collections..
well to bind the gridview to collection. refer this link
http://www.webdeveloper.com/forum/archive/index.php/t-88488.html
Dataset will give good performance
Thanks ur reply kavitha,
Can u please send me the detailed code or any sample projects which is developed by you.
vijaycit@yahoo.co.in
Can u please send me the detailed code or any sample projects which is developed by you using collection concepts.
vijaynetpart: Thanks ur reply kavitha,Can u please send me the detailed code or any sample projects which is developed by you using collection concepts.vijaycit@yahoo.co.in
DataTable dt = new DataTable(); dt.Columns.Add("roomCode"); dt.Columns.Add("roomNo"); dt.Columns.Add("hotelCode"); DataRow dr; dr = dt.NewRow(); dr["roomCode"] = "1"; dr["roomNo"] = "MKavs"; dr["hotelCode"] = "222"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["roomCode"] = "2"; dr["roomNo"] = "232"; dr["hotelCode"] = "33"; dt.Rows.Add(dr); gv.DataSource = dt; gv.DataBind(); //see above code : this is how u create a DataTable. Here u can see dr is the DataRows. So DataTable is collection of DataRows DataSet ds = new DataSet(); ds.Tables.Add(dt); //see above code : now i have added this table in to dataSet..i coud add more table to the dataset by doin something like this //ds.Tables.Add(dt2); and so on. //now to retrive the table from data set u have to do some thing liek this DataTable newDt = ds.Tables[0];