💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
刚开始的时候想的是用一句SQL语句写出所有,后来因SQL函数写不下去就用了代码 ~~~ protected string sDateJson; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DateTime dtnow = DateTime.Now; DataTable dttable = SqlEasy.ExecuteDataTable("select * from Psi_Goods"); foreach (DataRow dr in dttable.Rows) { DateTime dttime = Convert.ToDateTime(dr["up_time"].ToString()); if (dtnow.AddMonths(-4) > dttime) { sDateJson += "{\"KeyId\":" + dr["KeyId"].ToString() + ",\"goodsNo\":\"" + dr["goodsNo"].ToString() + "\",\"goodsName\":\"" + dr["goodsName"].ToString() + "\",\"goodsShortName\":\"" + dr["goodsShortName"].ToString() + "\",\"goodsClassName\":\"" + dr["goodsClassName"].ToString() + "\",\"specs\":\"" + dr["specs"].ToString() + "\",\"unit\":\"" + dr["unit"].ToString() + "\",\"stock\":\"" + dr["stock"].ToString() + "\",\"buyPrice\":\"" + dr["buyPrice"].ToString() + "\",\"up_time\":\"" + dr["up_time"].ToString() + "\",}"; } if (!string.IsNullOrEmpty(sDateJson)) { sDateJson = sDateJson.Substring(0, sDateJson.Length -1); } } } } ~~~