I created a C # .net application that uses dates from a SQL Server 2008 database table. Is there a way to temporarily store data so that my program does not require multiple server calls for the same set of information? I know how to get the information I need and create a temporary data set, however, it is only available for a specific method or class, and then it leaves. I need the results to be publicly available before the program closes.
This is what I still have, and I'm not sure where to go next:
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()) {
}
source
share