View my complete profile

Monday, September 19, 2011

Fill Data which return dataset in C#

Following is Function Filling dataset through dataadapter

public DataSet ExecuteQueryReturnDS(string stQuery)
{
DataSet ds = new DataSet();
using (SqlConnection sqlCon = new SqlConnection(connStr))
{
SqlCommand sqlCmd = new SqlCommand(stQuery, sqlCon);
SqlDataAdapter sqlAda = new SqlDataAdapter(sqlCmd);
sqlCmd.CommandTimeout = 999999;
sqlCmd.CommandType = CommandType.Text;
sqlAda.Fill(ds);
}
return ds;
}

0 comments:

Site Meter