title: Can I temporarily store data in my C#.Net app to reduce the need for calls for data from SQL Server?
body: <p>I created a C#.net app that uses dates from a SQL Server 2008 database table.  Is there a way for me to temporarily store the data so that my program does not have to repeatedly make server calls for the same set of information? I know how to pull the info I need and create a temporary dataset, however, it is only accessible to the particular method or class and then goes away.  I need the results to be universally available until the program closes. </p>
  
  <p>This is what I have so far and I am not sure where to go next:</p>
  
  <pre><code>SqlConnection ReportConnect = new SqlConnection(ConnectionString);
  String reportQuery = @"SELECT DISTINCT DATE FROM dbo.myTable ORDER BY DATE DESC";
  
  ReportConnect.Open();
  
  SqlCommand cmd = ReportConnect.CreateCommand();
  cmd.CommandType = CommandType.Text;
  cmd.Connection = ReportConnect;
  cmd.CommandText = reportQuery.ToString();
  
  SqlDataReader rdr = cmd.ExecuteReader();
  
  while(rdr.Read()) {
     //I can access the results here 
  }
  
  //how do I add this data for the life of the program instance to my current
  //dataset.  Let's say the dataset is named "activeDataset"
  </code></pre>