I have a select statement that binds data to a datagrid. It works fine but I also need an if statment to make sure the pageID exists, It needs to compare the current data to one in the expireTime field, and then if it has not expired and the page id exists then I need to set the datagrid visible. How can I modify this code? I tried but then the datagrid wasn't working.
pageID = Request.QueryString["pageID"];
objCmd = new SqlCommand("SELECT txtPageID, txtFileID, txtExpireTime, txtFileName FROM myLinks WHERE txtPageID=@pageID ORDER BY txtFileName", objConn);
objRdr = objCmd.ExecuteReader();
myDataGrid.DataSource = objRdr;