赞
踩
- DatabaseHelp.processDetailTableAdapter.FillByWeekReturnLatestID(dt, DateTime.Now.AddDays(-7), DateTime.Now);
- DataTable DT = dt as DataTable;
- if (DT.Rows.Count > 0)
- {
- // 原
- //DataRow lastRow = DT.Rows[DT.Rows.Count - 1];
- //var detailLastID = UserMath.ToInt32(lastRow["ID"].ToString());
-
- DataRow latestRow = DT.AsEnumerable()
- .OrderByDescending(row => row.Field<DateTime>("UpdateTime"))
- .FirstOrDefault();
- var detailLastID = UserMath.ToInt32(latestRow["ID"].ToString());
- }
string sql1 = $" SELECT Pwd FROM Userinfo where UserName=‘{UserName}’ AND IsDeleted=0";
DataTable dt= SqlHelper.GetDataTableBySql(sql1);//根据sql查出表
string rPwd = dt.Rows[0][“Pwd”].ToString();//取查出的第一行数据中,密码列的数据
网上查询关于DataTable类型数据查询所使用LINQ较少,记录一下
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。