tablehelper.cs

来自「基于C/S的医疗卫生管理系统」· CS 代码 · 共 31 行

CS
31
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;

namespace Qeb.Support.Common
{
    public class TableHelper
    {
        /// <summary>
        /// 列值转换为数组
        /// </summary>
        /// <param name="rows"></param>
        /// <param name="colName"></param>
        /// <returns></returns>
        public static string[] ColValueToArray(DataRow[] rows,string colName)
        {
            ArrayList myList = new ArrayList();
            foreach(DataRow dr in rows)
            {
                myList.Add(dr[colName].ToString());
            }

            return (string[])myList.ToArray(typeof(string));
        }

        
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?