How to use the DataGrid implementation according to the date to determine if a New flag is displayed

xiaoxiao2021-03-06  21

The page code is as follows:

Cellpadding = "0" autogeneratecolumns = "false" height = "100%" width = "224px" runat = "server">

DataTextField = "Title">

Backstage code:

SqlConnection Con = New SqlConnection (ConfigurationSettings.AppSettings ["strconn"]);

C.Open ();

Sqlcommand cmd = new sqlcommand ("SELECT ID, TITLE, dateDiff (day, senddate, getdate ()) as daycount from newinfo", con)

SqlDataAdapter Da = New SqlDataAdapter (CMD);

DataSet DS = New DataSet ();

Da.fill (DS);

C. close ();

MyGrid1.databind ();

// sendDate is a field of a DateTime type means a release date

转载请注明原文地址:https://www.9cbs.com/read-44377.html

New Post(0)