Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
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?
Posted
Updated 23-Jun-14 23:08pm
v3
Comments
Nirav Prabtani 24-Jun-14 5:01am    
?
_Asif_ 24-Jun-14 5:03am    
Can't understand your question!
onur_t 24-Jun-14 5:04am    
my question is linked with here

http://www.codeproject.com/Questions/789275/Division-of-Book-File?arn=0
onur_t 24-Jun-14 5:08am    
I'm trying to find the size of DataTable
Dave Kreskowiak 24-Jun-14 7:54am    
Size of what? The total size of the contents of the DataTable records or the DataTable object itself? No, they are the not the same!

1 solution

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


C#
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;     

}
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900