//编辑监控设备 public static int Edit(WatchDog watchdog) { string sql = "update watchdog set taiqu_id=@taiqu_id,ip_address=@ip_address where watchdog_id=@id)"; SqlParameter[] para = new SqlParameter[3]; para[0] = new SqlParameter("@id", watchdog.Id); para[1] = new SqlParameter("@taiqu_id", watchdog.Taiqu_id); para[2] = new SqlParameter("@ip_address", watchdog.Ip_address); try { return(Factory.Execute().ExecuteNonQuery(sql, CommandType.Text, para)); } catch (Exception e) { throw e; } }
//添加监控设备 public static int Add(WatchDog watchdog) { string sql = "insert into watchdog values (@id,@taiqu_id,@ip)"; SqlParameter[] para = new SqlParameter[3]; para[0] = new SqlParameter("@id", watchdog.Id); para[1] = new SqlParameter("@taiqu_id", watchdog.Taiqu_id); para[2] = new SqlParameter("@ip", watchdog.Ip_address); try { return(Factory.Execute().ExecuteNonQuery(sql, CommandType.Text, para)); } catch (Exception e) { throw e; } }