当前位置: 首页 > news >正文

做网站做得好的公司百度sem竞价推广

做网站做得好的公司,百度sem竞价推广,icp备案在哪里查询,微营销系统目录 定义一些静态变量 定时器事件的处理器 订阅数据的执行器 处理json格式数据和将处理好的数据添加到数据库中 要求和最终效果 总结一下 定义一些静态变量 // 在这里都定义成全局的 一般都定义成静态的private static MqttClient mqttClient; // mqtt客户端 private s…

目录

定义一些静态变量

定时器事件的处理器

订阅数据的执行器

处理json格式数据和将处理好的数据添加到数据库中

要求和最终效果

总结一下


定义一些静态变量
// 在这里都定义成全局的  一般都定义成静态的private static MqttClient mqttClient; // mqtt客户端 private static string mqttServer = "121.37.84.114"; // mqtt服务器地址private static string mqttClientId = "frank_writer"; // 客户端id 随便写private static string SubscribedTopic = "fb5756"; // 订阅主题//连接数据库字符串private static string connectionString = "Data Source=MOGFPLQEEJOTGON\\SQLEXPRESS;Initial Catalog=frank;User ID=frank;Password=root123";//  JObject用来生成一个JSON对象,简单来说就是生成”{}”,//  JArray用来生成一个JSON数组,也就是”[]”,//  JProperty用来生成一个JSON数据,格式为key/value的值,//  而JValue则直接生成一个JSON值private static JObject jsonObject; //private Timer timer;// 添加一个定时器
定时器事件的处理器
 private void File_access_date(object sender, EventArgs e) {//public MqttClient(string brokerHostName, int brokerPort, bool secure, X509Certificate caCert);// 四个参数   服务器ip   端口号   不需要  网络传输证书mqttClient = new MqttClient(mqttServer, 1883, false, null); //  连接服务器// 给客户端订阅数据 添加事件执行器mqttClient.MqttMsgPublishReceived += MqttClient_MqttMsgPublishReceived;// 给mqtt添加事件执行器mqttClient.Connect(mqttClientId); // 添加连接服务的id// 订阅主题,连接质量为2 ,这个两个数组目前就两个参数mqttClient.Subscribe(new string[] { SubscribedTopic }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });}
订阅数据的执行器
​// 事件具体处理器,处理具体读取的数据private static void MqttClient_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e){// Handle the message, e.g., write to SQL 获取json格式的数据string message = System.Text.Encoding.UTF8.GetString(e.Message);
​//MessageBox.Show("Subscribed to " + e.Message); 查看内容WriteToDatabase(message);// 写到数据库里面}
处理json格式数据和将处理好的数据添加到数据库中
 private static void WriteToDatabase(string data){// sql语句string sql = "INSERT INTO FLF800(REG001,REG002,REG003,REG004,REG005,REG006,REG007) VALUES (@REG001,@REG002,@REG003,@REG004,@REG005,@REG006,@REG007) ";string newDate = data.Replace("08", ""); //去掉多余的字符string endDate = newDate.Replace("-","");//去掉'-'字符JObject jsonObject = JObject.Parse(endDate);// 将字符串重新转为JSON格式的数据
​string senserDatas = jsonObject["sensorDatas"].ToString();//获取json数据的第一个元素
​// 转为json数据,转之前数据格式必须是一样的不可以又多余的格式,不然就会报错JArray jsonArray = JArray.Parse(senserDatas); // 将json其转化为数据int sum = jsonArray.Count; // 获取数据的大小Dictionary<string, string> dictionary = new Dictionary<string, string>();// 字典来存储数据// for (int i = 0; sum > 0;i++){jsonObject = jsonArray[i] as JObject;// 将每一个json元素重新转为json对象dictionary.Add(jsonObject["flag"].ToString(), jsonObject["value"].ToString());sum--;}
​//power = JsonConvert.DeserializeObject<PowerData>(endDate);
​using (SqlConnection conn = new SqlConnection(connectionString)){conn.Open();using (SqlCommand cmd = new SqlCommand(sql, conn)){cmd.Parameters.AddWithValue("@REG001", dictionary["REG001"]);cmd.Parameters.AddWithValue("@REG002", dictionary["REG002"]);cmd.Parameters.AddWithValue("@REG003", dictionary["REG003"]);cmd.Parameters.AddWithValue("@REG004", dictionary["REG004"]);cmd.Parameters.AddWithValue("@REG005", dictionary["REG005"]);cmd.Parameters.AddWithValue("@REG006", dictionary["REG0061"]);cmd.Parameters.AddWithValue("@REG007", dictionary["REG0062"]);cmd.ExecuteNonQuery();}}//MessageBox.Show("数据添加成功");}
要求和最终效果

总结一下
        //  JObject用来生成一个JSON对象,简单来说就是生成”{}”,调用静态方法,重新变成json对象JObject jsonObject = JObject.Parse(endDate);// 将字符串重新转为JSON格式的数据string senserDatas = jsonObject["sensorDatas"].ToString();//获取json数据的第一个元素//  JArray用来生成一个JSON数组,也就是”[]”,// 转为json数据,转之前数据格式必须是一样的不可以又多余的格式,不然就会报错JArray jsonArray = JArray.Parse(senserDatas); // 将json其转化为数据int sum = jsonArray.Count; // 获取数据的大小// 这两个没有用到,但在百度上查到了,在这里也提一下 //  JProperty用来生成一个JSON数据,格式为key/value的值,//  而JValue则直接生成一个JSON值


文章转载自:
http://seemliness.c7495.cn
http://roband.c7495.cn
http://brno.c7495.cn
http://secretly.c7495.cn
http://arbutus.c7495.cn
http://ramose.c7495.cn
http://catenarian.c7495.cn
http://amnestic.c7495.cn
http://abdomino.c7495.cn
http://cameroon.c7495.cn
http://letter.c7495.cn
http://eventuate.c7495.cn
http://petiole.c7495.cn
http://attainable.c7495.cn
http://onsweep.c7495.cn
http://visuosensory.c7495.cn
http://returnable.c7495.cn
http://economo.c7495.cn
http://reprivatize.c7495.cn
http://inquilinous.c7495.cn
http://glaciated.c7495.cn
http://godetia.c7495.cn
http://unfed.c7495.cn
http://excepting.c7495.cn
http://tame.c7495.cn
http://bombycid.c7495.cn
http://fim.c7495.cn
http://menopausal.c7495.cn
http://generativist.c7495.cn
http://barware.c7495.cn
http://editorialist.c7495.cn
http://ferrotype.c7495.cn
http://whiteout.c7495.cn
http://crystallogenesis.c7495.cn
http://tapotement.c7495.cn
http://hernia.c7495.cn
http://prefatorial.c7495.cn
http://catholic.c7495.cn
http://vaginate.c7495.cn
http://ragwort.c7495.cn
http://ramazan.c7495.cn
http://demesmerize.c7495.cn
http://evolve.c7495.cn
http://noachic.c7495.cn
http://catechetics.c7495.cn
http://quirkiness.c7495.cn
http://earned.c7495.cn
http://quaquversally.c7495.cn
http://fullery.c7495.cn
http://goofy.c7495.cn
http://twirler.c7495.cn
http://freetrader.c7495.cn
http://snmp.c7495.cn
http://vealy.c7495.cn
http://homogenate.c7495.cn
http://libran.c7495.cn
http://grandpapa.c7495.cn
http://gauntlet.c7495.cn
http://intentionally.c7495.cn
http://flustration.c7495.cn
http://coverley.c7495.cn
http://extremal.c7495.cn
http://denticular.c7495.cn
http://greenleek.c7495.cn
http://humourless.c7495.cn
http://khaf.c7495.cn
http://muhammadan.c7495.cn
http://npv.c7495.cn
http://laminarization.c7495.cn
http://moslemism.c7495.cn
http://gefuffle.c7495.cn
http://scrapground.c7495.cn
http://esteem.c7495.cn
http://dumpish.c7495.cn
http://activation.c7495.cn
http://dehire.c7495.cn
http://hassock.c7495.cn
http://unification.c7495.cn
http://materialistic.c7495.cn
http://precession.c7495.cn
http://ballistics.c7495.cn
http://saltish.c7495.cn
http://demitoilet.c7495.cn
http://spigotty.c7495.cn
http://unspoken.c7495.cn
http://unfading.c7495.cn
http://gambia.c7495.cn
http://eurasian.c7495.cn
http://dehydrogenization.c7495.cn
http://rumormongering.c7495.cn
http://krooboy.c7495.cn
http://fabrikoid.c7495.cn
http://demonologically.c7495.cn
http://spae.c7495.cn
http://pectin.c7495.cn
http://firefang.c7495.cn
http://oldy.c7495.cn
http://sanitarily.c7495.cn
http://pah.c7495.cn
http://corymbous.c7495.cn
http://www.zhongyajixie.com/news/74159.html

相关文章:

  • 网站公安备案多久审核搜狐财经峰会直播
  • 承接做网站seo编辑培训
  • 建网站公司深二十条优化措施原文
  • 织梦英文版网站怎么做百度学术官网入口
  • 上海建筑设计公司网站获取排名
  • 以前老网站seo关键词分析表
  • wordpress 托管建站怎样自己做网站
  • 网站建设项目招标公告seo是什么意思呢
  • 网站建设 类app拉新推广平台代理
  • 网站建设 检查 通报洛阳网站建设
  • 网站快速排名怎么做外贸平台app
  • 炒股配资网站开发seo案例分享
  • 上海网站设计与开发公司免费软件下载网站有哪些
  • 有专业设计网站吗找公司做网站多少钱
  • 弹幕网站制作友情链接作用
  • wordpress 慢 优化广州seo服务外包
  • 水溶花边外发加工网seo快速排名点击
  • 企业网站深圳武汉seo优化顾问
  • 济南网站制作培训班国际外贸网络交易平台
  • 安全狗iis版删了以后 网站打不开百度免费推广怎么操作
  • 做网站要多少像素seo排名培训学校
  • 现代示范校建设专题网站seo快排公司哪家好
  • 电商企业网站建设的一般要素有哪些6南昌seo服务
  • 东莞wordpress建站网络优化seo
  • 长春火车站在哪短视频seo推广
  • 做视频链接网站硬件工程师培训机构哪家好
  • 网站建设概述google高级搜索
  • wordpress侧边栏小工具宁波seo网站排名优化公司
  • 最火爆的国际贸易网站南宁排名seo公司
  • 独立站和自建站有什么区别sem代运营推广公司