SqlConnection sqlConnection1 = new SqlConnection ( "Server = localhost ; Database =  ; User ID = sa ; Password =  ; " ) ;
DataSet dataSet1 ;
SqlDataAdapter sqlDataAdapter1 ;
sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter ( "select client_status,count(*) from tb_yver where client_status!='正常' and client_status!='请选择' and employee='"+Session["employee"].ToString()+"' and convert(char(8),db_time,112)='"+datestr+"' and _success = 'Y' group by client_status order by client_status " , sqlConnection1 ) ;
dataSet1 = new DataSet ( ) ;
sqlDataAdapter1.Fill ( dataSet1 , "group" ) ;
DataView dataView1 = dataSet1.Tables [ "group" ].DefaultView ;
//实现数据绑定

this.Label2.Text = dataSet1.Tables["group"].Rows[0][1].ToString();
this.Label3.Text = dataSet1.Tables["group"].Rows[3][1].ToString();
this.Label4.Text = dataSet1.Tables["group"].Rows[7][1].ToString();
this.Label5.Text = dataSet1.Tables["group"].Rows[4][1].ToString();
this.Label6.Text = dataSet1.Tables["group"].Rows[5][1].ToString();
this.Label7.Text = dataSet1.Tables["group"].Rows[1][1].ToString();我想赋label2+label3+label4+label5+label6+label7的和给Label1。我试了试
this.Label1.Text = Convert.ToInt16(this.Label2.Text)+Convert.ToInt16(this.Label3.Text)+ Convert.ToInt16(this.Label4.Text)+Convert.ToInt16(this.Label5.Text)+Convert.ToInt16(this.Label6.Text)+Convert.ToInt16(this.Label7.Text); 不行。
求解~

解决方案 »

  1.   

    左边是string,右边是int,肯定不行
    int i = Convert.ToInt16(this.Label2.Text)+Convert.ToInt16(this.Label3.Text)+ Convert.ToInt16(this.Label4.Text)+Convert.ToInt16(this.Label5.Text)+Convert.ToInt16(this.Label6.Text)+Convert.ToInt16(this.Label7.Text); this.Label1.Text = i.ToString();
      

  2.   

    Label1.Text = 1
    Label2.Text = 2
    Label3.Text = Convert.ToString(int.Parse (Label1.Text) + int.Parse (Label2.Text)) ;
      

  3.   

    label1.text是字符串,
    this.Label1.Text =Convert.toString (Convert.ToInt16(this.Label2.Text)+Convert.ToInt16(this.Label3.Text)+ Convert.ToInt16(this.Label4.Text)+Convert.ToInt16(this.Label5.Text)+Convert.ToInt16(this.Label6.Text)+Convert.ToInt16(this.Label7.Text)); 
    试试看
      

  4.   

    this.Label1.Text = "" + Convert.ToInt16(this.Label2.Text)+Convert.ToInt16(this.Label3.Text)+ Convert.ToInt16(this.Label4.Text)+Convert.ToInt16(this.Label5.Text)+Convert.ToInt16(this.Label6.Text)+Convert.ToInt16(this.Label7.Text);