public void UpdateBank(BankOR _bank) { string sql = "truncate table t_Bank"; List<string> listCmd = new List<string>(); listCmd.Add(sql); sql = GetInsertSql(_bank); listCmd.Add(sql); dbMySql.ExecuteNoQueryTran(listCmd); }
/// <summary> /// 获取插入数据 /// </summary> public string GetInsertSql(BankOR bank) { string sql = @"insert into t_Bank (Id,OrgNo,OrgName,OrgBH,ParentOrgBH, Description,BankSort) values ('@Id','@OrgNo','@OrgName','@OrgBH','@ParentOrgBH', '@Description',BankSort)"; sql = sql.Replace("@Id", bank.Id); // sql = sql.Replace("@OrgNo", bank.Orgno); //机构编号 sql = sql.Replace("@OrgName", bank.Orgname); //机构名称 sql = sql.Replace("@OrgBH", bank.Orgbh); //机构编号 sql = sql.Replace("@ParentOrgBH", bank.Parentorgbh); //上级机构编号 sql = sql.Replace("@Description", bank.Description); //描述 sql = sql.Replace("@BankSort", bank.Banksort.ToString()); // return sql; }
/// <summary> /// 根据一个网点编号(5300),查询网点 /// </summary> /// <param name="orgNO"></param> /// <returns></returns> public BankOR selectABank(string orgNO) { string sql = string.Format("select * from t_Bank where orgno='{0}'", orgNO); DataTable dt = null; try { dt = dbMsSql.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } if (dt == null) return null; if (dt.Rows.Count == 0) return null; DataRow dr = dt.Rows[0]; BankOR m_Bank = new BankOR(dr); return m_Bank; }