I use lot of Dataset
for my website so far i have been using Dataset
as
string strSql = "SELECT * FROM Articles";
DataSet ds = new DataSet();
ds = DataProvider.Connect_Select(strSql);
string Title = ds.Tables[0].Rows[0]["Article_Title"].ToString();
string Desc = ds.Tables[0].Rows[0]["Article_Desc"].ToString();
CODE with Using
block
string strSql = "SELECT * FROM Articles";
// Create a DataSet in using statement.
using (DataSet ds = new DataSet())
{
ds = DataProvider.Connect_Select(strSql);
string Title = ds.Tables[0].Rows[0]["Article_Title"].ToString();
string Desc = ds.Tables[0].Rows[0]["Article_Desc"].ToString();
}
What is the best approach and optimized approach for using DataSet
Above code i am using SQL
Statment otherwise i use Stored Procedures