I have a webpage which displays content drawn from a single record in a database table. I've been asked to change this so that the content displayed alternates between 2 records each time the page is requested by a browser (I guess this would equate to each PageLoad event).
The records to be displayed are chosen on the basis of two dates, a beginning date and and ending date, that define a time period in which the record is to be active. The table containing these records has 2 columns containing these dates (begin date is contained in "dtDisplay" and end date is "lastDisplay."
I'm not sure how to amend the existing code behind to make this happen. Here is the c# that I inherited from a developer who is no longer available. Thanks for any help:
private void getfeatured_properties()
string today = DateTime.Now.Date.ToString();
SqlCommand cmd = common.openDatabase();
if (cmd.Connection.State == ConnectionState.Open)
string sql = "select propID from featured_properties where " +
"dtDisplay <= '" + today + "' and " +
"lastDisplay >= '" + today + "'";
View Complete Post