首页 > 代码库 > 获取DataRow的列名和值

获取DataRow的列名和值

            //dr的列名和值对应
            Dictionary<string, object> drDic = new Dictionary<string, object>();
            foreach (DataColumn item in dr.Table.Columns)
            {
                drDic.Add(item.ColumnName, dr[item.ColumnName]);
            }
            foreach (string key in drDic.Keys)
            {
                result += key + "=" + drDic[key].ToString() + "&";
            }    

 

获取DataRow的列名和值