SqlConnection Conn = new SqlConnection(
ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
SqlCommand Cmd = new SqlCommand();
string strSQL = "Select * From ";
Cmd.Connection = Conn;
Cmd.CommandText = strSQL;
DataTable myDT = new DataTable();
Conn.Open();
SqlDataAdapter myDA = new SqlDataAdapter(Cmd);
myDA.Fill(myDT);
Cmd.Dispose();
Conn.Close();
Conn.Dispose();
//*************************************************************
using (SqlConnection oConn = new SqlConnection())
{
using (SqlCommand oCmd = new SqlCommand())
{
string strSQL1 = "Select * From ";
Cmd.Connection = oConn;
Cmd.CommandText = strSQL1;
DataTable omyDT = new DataTable();
Conn.Open();
SqlDataAdapter omyDA = new SqlDataAdapter(oCmd);
omyDA.Fill(omyDT);
}
}