/// <summary> /// 更新一条数据 /// </summary> public void Update(MobileSoft.Model.System.Tb_System_DataBase model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@DBID", SqlDbType.Int, 4), new SqlParameter("@ProvinceID", SqlDbType.Int, 4), new SqlParameter("@CityID", SqlDbType.Int, 4), new SqlParameter("@BoroughID", SqlDbType.Int, 4), new SqlParameter("@StreetID", SqlDbType.Int, 4), new SqlParameter("@DBServer", SqlDbType.NVarChar, 20), new SqlParameter("@DBName", SqlDbType.NVarChar, 20), new SqlParameter("@DBUser", SqlDbType.NVarChar, 20), new SqlParameter("@DBPwd", SqlDbType.NVarChar, 20) }; parameters[0].Value = model.DBID; parameters[1].Value = model.ProvinceID; parameters[2].Value = model.CityID; parameters[3].Value = model.BoroughID; parameters[4].Value = model.StreetID; parameters[5].Value = model.DBServer; parameters[6].Value = model.DBName; parameters[7].Value = model.DBUser; parameters[8].Value = model.DBPwd; DbHelperSQL.RunProcedure("Proc_Tb_System_DataBase_Update", parameters, out rowsAffected); }
/// <summary> /// 得到一个对象实体 /// </summary> public MobileSoft.Model.System.Tb_System_DataBase GetModel(int DBID) { SqlParameter[] parameters = { new SqlParameter("@DBID", SqlDbType.Int, 4) }; parameters[0].Value = DBID; MobileSoft.Model.System.Tb_System_DataBase model = new MobileSoft.Model.System.Tb_System_DataBase(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_System_DataBase_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["DBID"].ToString() != "") { model.DBID = int.Parse(ds.Tables[0].Rows[0]["DBID"].ToString()); } if (ds.Tables[0].Rows[0]["ProvinceID"].ToString() != "") { model.ProvinceID = int.Parse(ds.Tables[0].Rows[0]["ProvinceID"].ToString()); } if (ds.Tables[0].Rows[0]["CityID"].ToString() != "") { model.CityID = int.Parse(ds.Tables[0].Rows[0]["CityID"].ToString()); } if (ds.Tables[0].Rows[0]["BoroughID"].ToString() != "") { model.BoroughID = int.Parse(ds.Tables[0].Rows[0]["BoroughID"].ToString()); } if (ds.Tables[0].Rows[0]["StreetID"].ToString() != "") { model.StreetID = int.Parse(ds.Tables[0].Rows[0]["StreetID"].ToString()); } model.DBServer = ds.Tables[0].Rows[0]["DBServer"].ToString(); model.DBName = ds.Tables[0].Rows[0]["DBName"].ToString(); model.DBUser = ds.Tables[0].Rows[0]["DBUser"].ToString(); model.DBPwd = ds.Tables[0].Rows[0]["DBPwd"].ToString(); return(model); } else { return(null); } }