class ClsDataReaderToDataTable
{
static void Main(string[] args)
{
string StrQuery = "SELECT * from MyTable";
DataTable DtCustomers = new DataTable();
using (SqlConnection oConn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionstring"].ConnectionString))
{
oConn.Open();
SqlCommand SCmd = new SqlCommand(StrQuery, oConn);
SqlDataReader SDr = SCmd.ExecuteReader();
DtCustomers.Load(SDr);
}
Console.ReadKey();
}
}
For training related to .net,OOPS and design patterns,
contact at sukeshmarla@gmail.com or Click Here
contact at sukeshmarla@gmail.com or Click Here
15 May 2011
SqlDataReader To DataTable
Subscribe to:
Posts (Atom)