//将int类型的字段改为string类型          

DataTable dtResult = new DataTable();
            dtResult = dt.Clone();
            foreach (DataColumn col in dtResult.Columns)
            {
               col.DataType = typeof(String);
            }
            for (int i = 0; i < dt.Rows.Count ; i++)
            {
                DataRow rowNew = dtResult.NewRow();
                for (int j = 0; j < dt.Columns.Count ; j++)
                {
                        if (Convert.ToInt32(dt.Rows[i][j]) == 0)
                        {
                            rowNew[j] = "不开考";
                        }
                        else if (Convert.ToInt32(dt.Rows[i][j]) == 1)
                        {
                            rowNew[j] = "开考";
                        }             
                }
                dtResult.Rows.Add(rowNew);
            }

相关文章:

  • 2021-11-28
  • 2021-08-20
  • 2022-12-23
  • 2021-12-05
  • 2021-12-19
  • 2021-11-28
  • 2021-06-10
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
  • 2021-11-17
  • 2022-02-01
相关资源
相似解决方案