perfomance pint of view which one is best

perfomance pint of view which one is best

23 Feb 2010 01:02:51
Hi There are two case to fetch data and bind with databount control in asp.net 1> fech data using sqldataReader but Paging not support so we want to load data into Datatable or dataset [code] SqlDataReader SQLDR; DataTable DTBankList=new DataTable(); SQLDR=objBankMst.GetList(); DTBankList.Load(SQLDR); GVBank.DataSource =DTBankList ; GVBank.DataBind(); [/code] 2> Second Fech data using datatable or Dataset and Directly bind with databoud control [code] DataTable DTBankList=new DataTable(); DTBankList=objBankMst.GetList(); GVBank.DataSource =DTBankList ; GVBank.DataBind(); [/code] perfomance point of view which one is Best? Regards Kirti Darji
Expert   Boarder
Posts: 28
From 03-Jun-2009
You're Points: 538
Bookmark
Re:perfomance pint of view which one is best23 Feb 2010 01:02:51
Hi First i would say SqlDataReader is most fast to read data the from the database. since that first way is good and you can get fully performance. You can write code like this way. {codecitation class="brush: csharp; gutter: true;" width="650px"} DataTable DTBankList = new DataTable(); //objBankMst.GetList(); make sure this function return the IDataReader DTBankList.Load(objBankMst.GetList()); GVBank.DataSource = DTBankList; GVBank.DataBind(); {/codecitation} And when you using the sql database related COM objects better to use the using keyword. {codecitation class="brush: csharp; gutter: true;" width="650px"} using(SqlConnection conn =new SqlConnection("") { /// here add your code } {/codecitation} I hope this is help to you lot. Thank you
RRaveen
Gold  Boarder
Posts: 156
From 03-Jun-2009
You're Points: 1106
Bookmark
Re:perfomance pint of view which one is best23 Feb 2010 01:02:51
Welcome buddy.
RRaveen
Gold  Boarder
Posts: 156
From 03-Jun-2009
You're Points: 1106
Bookmark
Re:perfomance pint of view which one is best23 Feb 2010 01:02:51
Thanks
Kirti.Darji.001
Expert  Boarder
Posts: 28
From 03-Jun-2009
You're Points: 538
Bookmark
^ Scroll to Top