/// <summary> /// 获取保存在本地的MAC对应的密码 /// </summary> /// <param name="woId"></param> /// <param name="mac"></param> /// <param name="pwdtype"></param> /// <returns></returns> public static Dictionary <string, string> GetMacPwdByUse(string woId, string mac) { Dictionary <string, string> lspwd = new Dictionary <string, string>(); BLL.cdbAccess cda = new BLL.cdbAccess(); try { DataTable dt = cda.GetDatatable(string.Format("select pwdval from UsePwd where mac='{1}' and woId='{0}'" , mac, woId)); if (dt == null || dt.Rows.Count < 1) { return(new Dictionary <string, string>()); } else { foreach (DataRow dr in dt.Rows) { lspwd.Add(dr["pwdtype"].ToString(), dr["pwdval"].ToString()); } } return(lspwd); } catch { return(new Dictionary <string, string>()); } }
public static string InsertLocalWoPwd(ref DataTable mdt) { BLL.cdbAccess cda = new BLL.cdbAccess(); foreach (DataRow dr in mdt.Rows) { string sql = string.Format("insert into UsePwd(mac,woId,pwdtype,pwdval) values('{0}','{1}','{2}','{3}')", dr["mac"].ToString(), dr["woId"].ToString(), dr["pwdtype"].ToString(), dr["pwdval"].ToString()); if (cda.ExecuteSqlCommand(sql)) { return("数据导入失败,请检查"); } } return(string.Empty); }