コード例 #1
0
ファイル: frmDataNowD.cs プロジェクト: hkiaipc/guye
 /// <summary>
 /// 
 /// </summary>
 private void LoadDatas()
 {
     try
         {
             DBcon con=new DBcon();
             SqlCommand cmd=new SqlCommand("SELECT top 1 * FROM v_rzreallast where StationName='"+s_name+"' order by DT desc",con.GetConnection());
             SqlDataReader dr=cmd.ExecuteReader();
             if(!dr.Read())
             {
                 MessageBox.Show("��վ���������ݣ�");
                 dr.Close();
                 cmd.Dispose();
                 return;
             }
             dr.Close();
             cmd.Dispose();
             SqlDataAdapter da=new SqlDataAdapter("SELECT top 1 * FROM v_rzreallast where StationName='"+s_name+"' order by DT desc",con.GetConnection());
             DataSet ds=new DataSet();
             da.Fill(ds,"GRValue");
             this.labOneGT.Text = ds.Tables["GRValue"].Rows[0]["oneGiveTemp"].ToString() + " ��";
             this.labOneGP.Text=ds.Tables["GRValue"].Rows[0]["oneGivePress"].ToString()+" Mpa";
             this.labOneBT.Text = ds.Tables["GRValue"].Rows[0]["oneBackTemp"].ToString() + " ��";
             this.labOneBP.Text=ds.Tables["GRValue"].Rows[0]["oneBackPress"].ToString()+" Mpa";
             this.labOneInstant.Text=ds.Tables["GRValue"].Rows[0]["oneAccum"].ToString()+" m3";
             this.labOpenDegree.Text=ds.Tables["GRValue"].Rows[0]["openDegree"].ToString()+" %";
             this.labOneHeat.Text = ds.Tables["GRValue"].Rows[0]["OneHeat"].ToString() + " ��";
             this.labOutT.Text = ds.Tables["GRValue"].Rows[0]["outsideTemp"].ToString() + " ��";
             this.labTwoBP.Text=ds.Tables["GRValue"].Rows[0]["twoBackPress"].ToString()+" Mpa";
             this.labTwoBT.Text = ds.Tables["GRValue"].Rows[0]["twoBackTemp"].ToString() + " ��";
             this.labTwoGP.Text=ds.Tables["GRValue"].Rows[0]["twoGivePress"].ToString()+" Mpa";
             this.labTwoGT.Text = ds.Tables["GRValue"].Rows[0]["twoGiveTemp"].ToString() + " ��";
             this.labWatBox.Text=ds.Tables["GRValue"].Rows[0]["WatBoxLevel"].ToString()+" m";
             this.labSubIn.Text=ds.Tables["GRValue"].Rows[0]["SubInstant"].ToString()+" m3/min";
             this.label1.Text=ds.Tables["GRValue"].Rows[0]["DT"].ToString();
         if(ds.Tables["GRValue"].Rows[0]["pumpState1"].ToString()=="���")
           {
             this.xunhua.Text="1��ѭ����״̬�����";
             this.picBox1.Visible=false;
           }
         else
           {
              this.xunhua.Text="1��ѭ����״̬��ֹͣ";
              this.picBox1.Visible=true;
           }
         if(ds.Tables["GRValue"].Rows[0]["pumpState2"].ToString()=="���")
           {
             this.xunhua1.Text="2��ѭ����״̬�����";
             this.picBox2.Visible=false;
           }
         else
           {
             this.xunhua1.Text="2��ѭ����״̬��ֹͣ";
            this.picBox2.Visible=true;
          }
         if(ds.Tables["GRValue"].Rows[0]["pumpState3"].ToString()=="���")
           {
             this.xunhua2.Text="3��ѭ����״̬�����";
             this.picBox3.Visible=false;
           }
         else
           {
             this.xunhua2.Text="3��ѭ����״̬��ֹͣ";
             this.picBox3.Visible=true;
           }
         if(ds.Tables["GRValue"].Rows[0]["addPumpState1"].ToString()=="���")
          {
             this.bushui.Text="1�Ų�ˮ��״̬�����";
             this.picBox4.Visible=false;
          }
         else
            {
              this.bushui.Text="1�Ų�ˮ��״̬��ֹͣ";
              this.picBox4.Visible=true;
            }
         if(ds.Tables["GRValue"].Rows[0]["addPumpState2"].ToString()=="���")
           {  this.bushui1.Text="2�Ų�ˮ��״̬�����";
              this.picBox5.Visible=false;
           }
         else
           {
             this.bushui1.Text="2�Ų�ˮ��״̬��ֹͣ";
             this.picBox5.Visible=true;
           }
             da.Dispose();
         }
         catch(Exception ex)
         {
             //MessageBox.Show("ʵʱ���ݶ�ȡʧ��!","����",MessageBoxButtons.OK,MessageBoxIcon.Error);
             ExceptionHandler.Handle("ʵʱ���ݶ�ȡʧ��!", ex );
         }
 }
コード例 #2
0
ファイル: frmDataNowD.cs プロジェクト: wwkkww1983/bt
 /// <summary>
 ///
 /// </summary>
 private void LoadDatas()
 {
     try
     {
         DBcon         con = new DBcon();
         SqlCommand    cmd = new SqlCommand("SELECT top 1 * FROM v_grstlastrd where name='" + s_name + "' order by time desc", con.GetConnection());
         SqlDataReader dr  = cmd.ExecuteReader();
         if (!dr.Read())
         {
             MessageBox.Show("¸ÃÕ¾µãÔÝÎÞÊý¾Ý£¡");
             dr.Close();
             cmd.Dispose();
             return;
         }
         dr.Close();
         cmd.Dispose();
         SqlDataAdapter da = new SqlDataAdapter("SELECT top 1 * FROM V_HeatDatas where name='" + s_name + "' order by time desc", con.GetConnection());
         DataSet        ds = new DataSet();
         da.Fill(ds, "GRValue");
         this.labOneGT.Text      = ds.Tables["GRValue"].Rows[0]["oneGiveTemp"].ToString() + " C";
         this.labOneGP.Text      = ds.Tables["GRValue"].Rows[0]["oneGivePress"].ToString() + " Mpa";
         this.labOneBT.Text      = ds.Tables["GRValue"].Rows[0]["oneBackTemp"].ToString() + " C";
         this.labOneBP.Text      = ds.Tables["GRValue"].Rows[0]["oneBackPress"].ToString() + " Mpa";
         this.labOneInstant.Text = ds.Tables["GRValue"].Rows[0]["oneAccum"].ToString() + " T";
         this.labOpenDegree.Text = ds.Tables["GRValue"].Rows[0]["openDegree"].ToString() + " %";
         this.labOutT.Text       = ds.Tables["GRValue"].Rows[0]["outsideTemp"].ToString() + " C";
         this.labTwoBP.Text      = ds.Tables["GRValue"].Rows[0]["twoBackPress"].ToString() + " Mpa";
         this.labTwoBT.Text      = ds.Tables["GRValue"].Rows[0]["twoBackTemp"].ToString() + " C";
         this.labTwoGP.Text      = ds.Tables["GRValue"].Rows[0]["twoGivePress"].ToString() + " Mpa";
         this.labTwoGT.Text      = ds.Tables["GRValue"].Rows[0]["twoGiveTemp"].ToString() + " C";
         this.labWatBox.Text     = ds.Tables["GRValue"].Rows[0]["WatBoxLevel"].ToString() + " M";
         string NowT = ds.Tables["GRValue"].Rows[0]["Time"].ToString();
         if (ds.Tables["GRValue"].Rows[0]["pumpState1"].ToString() == "True")
         {
             this.xunhua.Text  = "1ºÅÑ­»·±Ã״̬£ºÆô¶¯";
             this.xunhua2.Text = "2ºÅÑ­»·±Ã״̬£ºÆô¶¯";
         }
         else if (ds.Tables["GRValue"].Rows[0]["pumpState2"].ToString() == "True")
         {
             this.xunhua.Text  = "1ºÅÑ­»·±Ã״̬£ºÆô¶¯";
             this.xunhua2.Text = "2ºÅÑ­»·±Ã״̬£ºÆô¶¯";
         }
         else if (ds.Tables["GRValue"].Rows[0]["pumpState3"].ToString() == "True")
         {
             this.xunhua.Text  = "1ºÅÑ­»·±Ã״̬£ºÆô¶¯";
             this.xunhua2.Text = "2ºÅÑ­»·±Ã״̬£ºÆô¶¯";
         }
         else
         {
             this.xunhua.Text  = "1ºÅÑ­»·±Ã״̬£ºÍ£Ö¹";
             this.xunhua2.Text = "2ºÅÑ­»·±Ã״̬£ºÍ£Ö¹";
         }
         if (ds.Tables["GRValue"].Rows[0]["addPumpState1"].ToString() == "True")
         {
             this.bushui.Text = "²¹Ë®±Ã״̬£ºÆô¶¯";
         }
         else if (ds.Tables["GRValue"].Rows[0]["addPumpState2"].ToString() == "True")
         {
             this.bushui.Text = "²¹Ë®±Ã״̬£ºÆô¶¯";
         }
         else
         {
             this.bushui.Text = "²¹Ë®±Ã״̬£ºÍ£Ö¹";
         }
         da.Dispose();
     }
     catch (Exception ex)
     {
         //MessageBox.Show("ʵʱÊý¾Ý¶Áȡʧ°Ü!","´íÎó",MessageBoxButtons.OK,MessageBoxIcon.Error);
         ExceptionHandler.Handle("ʵʱÊý¾Ý¶Áȡʧ°Ü!", ex);
     }
 }
コード例 #3
0
ファイル: frmDataNow.cs プロジェクト: wwkkww1983/bt
 private void LoadDatas()
 {
     try
     {
         DBcon         con = new DBcon();
         SqlCommand    cmd = new SqlCommand("SELECT top 1 * FROM v_grstlastrd where name='" + s_name + "' order by time desc", con.GetConnection());
         SqlDataReader dr  = cmd.ExecuteReader();
         if (!dr.Read())
         {
             MessageBox.Show("该站点暂无数据!");
             dr.Close();
             cmd.Dispose();
             return;
         }
         dr.Close();
         cmd.Dispose();
         SqlDataAdapter da = new SqlDataAdapter("SELECT top 1 * FROM V_HeatDatas where name='" + s_name + "' order by time desc", con.GetConnection());
         DataSet        ds = new DataSet();
         da.Fill(ds, "GRValue");
         this.labOneGT.Text      = ds.Tables["GRValue"].Rows[0]["oneGiveTemp"].ToString() + " C";
         this.labOneGP.Text      = ds.Tables["GRValue"].Rows[0]["oneGivePress"].ToString() + " Mpa";
         this.labOneBT.Text      = ds.Tables["GRValue"].Rows[0]["oneBackTemp"].ToString() + " C";
         this.labOneBP.Text      = ds.Tables["GRValue"].Rows[0]["oneBackPress"].ToString() + " Mpa";
         this.labOneInstant.Text = ds.Tables["GRValue"].Rows[0]["oneAccum"].ToString() + " T";
         this.labOpenDegree.Text = ds.Tables["GRValue"].Rows[0]["openDegree"].ToString() + " %";
         this.labOutT.Text       = ds.Tables["GRValue"].Rows[0]["outsideTemp"].ToString() + " C";
         this.labTwoBP.Text      = ds.Tables["GRValue"].Rows[0]["twoBackPress"].ToString() + " Mpa";
         this.labTwoBT.Text      = ds.Tables["GRValue"].Rows[0]["twoBackTemp"].ToString() + " C";
         this.labTwoGP.Text      = ds.Tables["GRValue"].Rows[0]["twoGivePress"].ToString() + " Mpa";
         this.labTwoGT.Text      = ds.Tables["GRValue"].Rows[0]["twoGiveTemp"].ToString() + " C";
         this.labWatBox.Text     = ds.Tables["GRValue"].Rows[0]["WatBoxLevel"].ToString() + " M";
         string NowT = ds.Tables["GRValue"].Rows[0]["Time"].ToString();
         string dsd  = ds.Tables["GRValue"].Rows[0]["addPumpState1"].ToString();
         if (ds.Tables["GRValue"].Rows[0]["pumpState1"].ToString() == "True")
         {
             this.xunhua.Text = "循环泵状态:启动";
         }
         else if (ds.Tables["GRValue"].Rows[0]["pumpState2"].ToString() == "True")
         {
             this.xunhua.Text = "循环泵状态:启动";
         }
         else if (ds.Tables["GRValue"].Rows[0]["pumpState3"].ToString() == "True")
         {
             this.xunhua.Text = "循环泵状态:启动";
         }
         else
         {
             this.xunhua.Text = "循环泵状态:停止";
         }
         if (ds.Tables["GRValue"].Rows[0]["addPumpState1"].ToString() == "True")
         {
             this.bushui.Text = "补水泵状态:启动";
         }
         else if (ds.Tables["GRValue"].Rows[0]["addPumpState2"].ToString() == "True")
         {
             this.bushui.Text = "补水泵状态:启动";
         }
         else
         {
             this.bushui.Text = "补水泵状态:停止";
         }
         //				if(ds.Tables["GRValue"].Rows[0]["addPumpState1"].ToString()=="Ture"||ds.Tables["GRValue"].Rows[0]["addPumpState1"].ToString()=="Ture")
         //					this.bushui.Text="补水泵状态:启动";
         //				else
         //					this.bushui.Text="补水泵状态:停止";
         da.Dispose();
     }
     catch (Exception ex)
     {
         //MessageBox.Show("实时数据读取失败!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
         ExceptionHandler.Handle("实时数据读取失败!", ex);
     }
 }