例如数据库的值为0,1,2  
分别代表 进行、暂停、停止  想让他们显示时就显示汉字 请问怎么做?

解决方案 »

  1.   

    select ColumnA=case when 0 then '进行' when 1 then '暂停' when 2 then '停止' from table
      

  2.   

    1,在SQL中写,when 0 then 进行等SQL
    2,在gridview的gridview_RowDataBound 事件中 判断 
      if (e.Row.RowType != DataControlRowType.EmptyDataRow && e.Row.RowType == DataControlRowType.DataRow)
                {
                    string strGid = this.gridview.DataKeys[e.Row.RowIndex].Values["PHOTO_ALBUM_ID"].ToString();
    if (strGid =0)
    {
    e.Row.Cells[3].Text = 进行 ;
    }
        
                }
      

  3.   

    e.Row.Cells[3].Text //这是什么意思?
      

  4.   

    可以在页面的后台(aspx.cs)中写一个函数
     public string GetZhi(int datas)
    {
     if(datas==0){
    return "进行";
    }

    }<# GetZhi(0)>
      
      

  5.   

    如2楼所述在OnRowDataBound 事件中重新赋值 
    e.Row.Cells[3].Text 当前行的第3列
      

  6.   


       private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
          {          if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("Column3"))
              {              string TYpeID = e.Value.ToString();
                  e.Value =......//转换代码          }
          }