By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,196 Members | 1,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,196 IT Pros & Developers. It's quick & easy.

write text file into dataset

P: n/a
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 (

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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.