/// <summary> /// 得到一个对象实体 /// </summary> public LPWeb.Model.CompanyExecutives GetModel(int ExecutiveId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ExecutiveId from CompanyExecutives "); strSql.Append(" where ExecutiveId=@ExecutiveId "); SqlParameter[] parameters = { new SqlParameter("@ExecutiveId", SqlDbType.Int, 4) }; parameters[0].Value = ExecutiveId; LPWeb.Model.CompanyExecutives model = new LPWeb.Model.CompanyExecutives(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ExecutiveId"].ToString() != "") { model.ExecutiveId = int.Parse(ds.Tables[0].Rows[0]["ExecutiveId"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LPWeb.Model.CompanyExecutives model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CompanyExecutives set "); strSql.Append("ExecutiveId=@ExecutiveId"); strSql.Append(" where ExecutiveId=@ExecutiveId "); SqlParameter[] parameters = { new SqlParameter("@ExecutiveId", SqlDbType.Int, 4) }; parameters[0].Value = model.ExecutiveId; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(LPWeb.Model.CompanyExecutives model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CompanyExecutives("); strSql.Append("ExecutiveId)"); strSql.Append(" values ("); strSql.Append("@ExecutiveId)"); SqlParameter[] parameters = { new SqlParameter("@ExecutiveId", SqlDbType.Int, 4) }; parameters[0].Value = model.ExecutiveId; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }