/// <summary> /// 调用存储过程增加一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns> public static int area_provinceAdd(Entity.area_province info) { SqlParameter[] prams = { SqlDB.MakeInParam("@Name", SqlDbType.NVarChar, 32, info.Name), SqlDB.MakeInParam("@country_id", SqlDbType.VarChar, 6, info.country_id), }; return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(strCon, CommandType.StoredProcedure, "area_provinceAdd", prams).ToString(), -1)); }
/// <summary> /// 获取某一个实体 /// </summary> /// <param name="id">标识</param> /// <returns>返回Entity</returns> public static Entity.area_province area_provinceEntityGet(int id) { Entity.area_province info = new Entity.area_province(); DataTable dt = SqlDB.ExecuteDataset(strCon, CommandType.Text, "SELECT * FROM [area_province] WHERE id = " + id + ";").Tables[0]; if (dt.Rows.Count > 0) { info.id = dt.Rows[0]["id"].ToString(); info.Name = dt.Rows[0]["Name"].ToString(); info.country_id = dt.Rows[0]["country_id"].ToString(); } return(info); }
/// <summary> /// 调用存储过程修改一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>更新成功返回ture,否则返回false</returns> public static bool area_provinceEdit(Entity.area_province info) { SqlParameter[] prams = { SqlDB.MakeInParam("@id", SqlDbType.VarChar, 6, info.id), SqlDB.MakeInParam("@Name", SqlDbType.NVarChar, 32, info.Name), SqlDB.MakeInParam("@country_id", SqlDbType.VarChar, 6, info.country_id), }; int intReturnValue = 0; intReturnValue = SqlDB.ExecuteNonQuery(strCon, CommandType.StoredProcedure, "area_provinceEdit", prams); if (intReturnValue == 1) { return(true); } return(false); }