从DataTable读取数据的最快方法 [英] the fastest way to read the data from DataTable

查看:834
本文介绍了从DataTable读取数据的最快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以最快的方式读取DataTable中的数据?



逐个字符

录音录音

记录*记录大小,他们不能



我正在试图找到DataTable的大小



还有什么?

How can I read the data in DataTable fastest way?

character by character
recording by recording
records * record size, they can not

I'm trying to find the size of DataTable

what else?

推荐答案

你可以serlielise数据集和chechk没有使用的字节。

但为什么你需要这个?





You can serlielise dataset and chechk no of bytes used.
But why you required this?


public static int GetDataLength(DataTable dt)
{

DataSet ds= new DataSet();
ds.Tables.Add(dt);

BinaryFormatter bf = new BinaryFormatter();
        MemoryStream ms = new MemoryStream();
        byte[] Array;
        bf.Serialize(ms, ds);
        Array = ms.ToArray();
        return Array.Length;     

}


这篇关于从DataTable读取数据的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆