469,601 Members | 2,039 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

write text file into dataset

I want to read a text file, and then write it into dataset. Is it possible?
or Is there any solution that read text file into DB?

Posted by a user from .NET 247 (http://www.dotnet247.com/)

Nov 17 '05 #1
1 9542
Hi WebSim,

Just store the text file as a byte[].

DataSet set = new DataSet();
set.Tables.Add(new DataTable());
set.Tables[0].Columns.Add(new DataColumn("col", typeof(byte[])));

FileStream fs = File.OpenRead("any.file");
byte[] b = new byte[fs.Length];
fs.Read(b, 0, (int)fs.Length);

DataRow dr = set.Tables[0].NewRow();
dr[0] = b;
Happy Coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by jason hirst | last post: by
reply views Thread by Dean Slindee | last post: by
4 posts views Thread by marcmc | last post: by
6 posts views Thread by Hans | last post: by
12 posts views Thread by =?Utf-8?B?Smlt?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.