tags:

views:

571

answers:

3

I need to load a file (usually ASCII) into a DataSet. How can I do that? What data types should I use for my columns?

Thanks.

+3  A: 

you can use byte[] for the type,

Maybe a DataTable like this can be useful for you

DataTable dt = new DataTable("files");
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("size", typeof(int));
dt.Columns.Add("content", typeof(byte[]));
Jhonny D. Cano -Leftware-
+3  A: 

Not sure if this is what you are looking for but you can find a sample here:

Fill a DataSet from delimited text files

Gulzar
+2  A: 

DataSet is one huge typeless hole, it should be the least of your worries. Add some reflection for more fragility and you should be there within seconds.. It also ends up with plenty of casts.

Again bad design, columns can be anything and as such you can add or retrieve any type any way you or they want it and your syntax will be damaged. You get no compile-time safety, simple.

Better type your data and then pass the typeless dust to DataSet via an extension method.. XML kids do the same for XML files (which is just as nuts).

rama-jka toti