How do I display multiple questions per day? Also, I am using Visual Studio 2005 and am using a database to retrieve the data.
This is the sample code:
private string GetCurrentQuestion()
{
string str = "";
DataAccess da = new DataAccess();
DataSet ds = new DataSet();
da.Connect();
ds = da.GetData("select * from questions where qdate = #" + DateTime.Now.ToString("dd-MMM-yyyy") + "#");
if (ds.Tables[0].Rows.Count > 0)
{
str = "Question: " + ds.Tables[0].Rows[0]["ques"].ToString();
str += "\nA." + ds.Tables[0].Rows[0]["ans1"].ToString();
str += "\nB." + ds.Tables[0].Rows[0]["ans2"].ToString();
str += "\nC." + ds.Tables[0].Rows[0]["ans3"].ToString();
str += "\nD." + ds.Tables[0].Rows[0]["ans4"].ToString();
}
else
{
str = "Sorry! No Questions Today! Try again Tomorrow!";
}
da.Disconnect();
return str;
}