示例#1
0
        public void Update(UGraph ua, int?id)
        {
            cn.Open();
            string     cm = $"update U_Graph set PMonth={ua.PMonth},Months={ua.Months}";
            SqlCommand cd = new SqlCommand(cm, cn);

            cd.ExecuteNonQuery();
            cn.Close();
        }
示例#2
0
        public void Add(UGraph ug)
        {
            cn.Open();
            string     cm = $"insert into U_Graph(PMonth,U_AppId,Months) Values({ug.PMonth},{ug.U_AppId},{ug.Months});";
            SqlCommand cd = new SqlCommand(cm, cn);

            cd.ExecuteNonQuery();
            cn.Close();
        }
示例#3
0
        public UGraph SingleById(int?id)
        {
            cn.Open();
            string        cm = $"select * from U_Graph where U_AppId = {id}";
            SqlCommand    cd = new SqlCommand(cm, cn);
            SqlDataReader r  = cd.ExecuteReader();
            UGraph        ml = new UGraph();

            while (r.Read())
            {
                ml = new UGraph()
                {
                    id      = int.Parse(r.GetValue("id").ToString()),
                    Months  = double.Parse(r.GetValue("Months").ToString()),
                    PMonth  = double.Parse(r.GetValue("PMonth").ToString()),
                    U_AppId = int.Parse(r.GetValue("U_AppId").ToString())
                };
            }
            cn.Close();
            return(ml);
        }