| 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 | |