<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting Started</title><link>http://forums.asp.net/15.aspx</link><description>The perfect forum for ASP.NET novices. No question too simple! &lt;A href="http://aspadvice.com/SignUp/list.aspx?l=21&amp;amp;c=17" target=_blank&gt;Email List&lt;/A&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1088456.aspx</link><pubDate>Thu, 20 Oct 2005 01:42:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1088456</guid><dc:creator>devnull</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1088456.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1088456</wfw:commentRss><description>&lt;pre&gt;using (StreamWriter sw = new StreamWriter(Server.MapPath("~/exported/file.txt")))&lt;br&gt;{&lt;br&gt;    // assume my previous post method is named: RetrieveRecord() and returns a StringBuilder&lt;br&gt;    sw.Write(RetrieveRecord().ToString());&lt;br&gt;    sw.Close();&lt;br&gt;}&lt;br&gt;&lt;br&gt;Response.Write("right click &amp;lt;a href=\"exported/file.txt\"&amp;gt;here&amp;lt;/a&amp;gt; then save as to download the record");&lt;br&gt;&lt;/pre&gt;</description></item><item><title>Re: export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1088433.aspx</link><pubDate>Thu, 20 Oct 2005 00:59:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1088433</guid><dc:creator>nivram</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1088433.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1088433</wfw:commentRss><description>Actually what i want is to do this in vb like i have specified in my
subject. But anyway, i have no problem with how to save data into
textfile what i want is after having save it will continue to save to
users computer. Ofcourse with a option to choose a filename.&lt;br&gt;
&lt;br&gt;
Here is again the flow:&lt;br&gt;
&lt;br&gt;
After clicking a link like "download record".&lt;br&gt;
1. Do a program that will save the record from database to textfile and save first to the webserver.&lt;br&gt;
2. Then will continue to save to users computer by choosing what
filename and where dorectory. It is just like you are downloading a
file from the internet.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;</description></item><item><title>Re: export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1087465.aspx</link><pubDate>Wed, 19 Oct 2005 11:30:28 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1087465</guid><dc:creator>NC01</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1087465.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1087465</wfw:commentRss><description>Both posts&amp;nbsp;that have&amp;nbsp;code in them are in C#.&lt;BR&gt;&lt;BR&gt;NC...&lt;BR&gt;</description></item><item><title>Re: export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1087403.aspx</link><pubDate>Wed, 19 Oct 2005 10:02:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1087403</guid><dc:creator>Muller2</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1087403.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1087403</wfw:commentRss><description>Does anyone have this code in c#?&lt;span&gt;It would be incredible handy!&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;Thanks&lt;br&gt;
&lt;br&gt;
Muller2&lt;br&gt;
&lt;br&gt;</description></item><item><title>Re: export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1087351.aspx</link><pubDate>Wed, 19 Oct 2005 08:53:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1087351</guid><dc:creator>altunbay</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1087351.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1087351</wfw:commentRss><description>&lt;font face="Arial" size="2"&gt;//You should get data into datatable&lt;br&gt;
DataTable dt=new DataTable;&lt;br&gt;
// Write data in datatable to a text file&lt;br&gt;
string path = Server.MapPath("")+"\\files\\temp.txt";&lt;br&gt;
StreamWriter sw = new StreamWriter(path,false);&lt;br&gt;
&amp;nbsp;foreach(DataRow dr in dt.Rows)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; string line="";&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach(DataColumn dc in dt.Columns)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;  line+=dr[dc.Name].ToString()+"\t";&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.WriteLine(line);&lt;br&gt;
}&lt;br&gt;
sw.Close();&lt;br&gt;
&lt;br&gt;
//Read the file to a byte array&lt;br&gt;
&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;Stream s = File.OpenRead(path);&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;Byte[] buffer = new Byte[s.Length];&lt;br&gt;
s.Read(buffer, 0, (Int32) s.Length);&lt;br&gt;
//Clear the headers and write the byte arras as file to buffer&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;Response.ClearHeaders();&lt;br&gt;
Response.ClearContent();&lt;br&gt;
Response.ContentType = "application/octet-stream";&lt;br&gt;
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);&lt;br&gt;
Response.BinaryWrite(buffer);&lt;br&gt;
Response.End();&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1087331.aspx</link><pubDate>Wed, 19 Oct 2005 08:22:19 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1087331</guid><dc:creator>devnull</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1087331.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1087331</wfw:commentRss><description>&lt;PRE&gt;StringBuilder output &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; StringBuilder(); &lt;SPAN&gt;// will hold the record&lt;BR&gt;&lt;/SPAN&gt;
SqlDataReader dr &lt;SPAN&gt;=&lt;/SPAN&gt; sqlCmd.ExecuteReader();&lt;BR&gt;DataTable dt &lt;SPAN&gt;=&lt;/SPAN&gt; dr.GetSchemaTable(); &lt;SPAN&gt;// get column names&lt;BR&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;for&lt;/SPAN&gt; (&lt;SPAN&gt;int&lt;/SPAN&gt; i &lt;SPAN&gt;=&lt;/SPAN&gt; 0; i &amp;lt; dt.Rows.Count; i++)&lt;BR&gt;{&lt;BR&gt;    output.Append('&lt;SPAN&gt;"');&lt;BR&gt;    output.Append(dt.Rows[i ]["&lt;/SPAN&gt;ColumnName&lt;SPAN&gt;"].ToString().Trim());&lt;BR&gt;    output.Append('"&lt;/SPAN&gt;');&lt;BR&gt;    output.Append(',');&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;while&lt;/SPAN&gt; (dr.Read())&lt;BR&gt;{&lt;BR&gt;    output.Append(&lt;SPAN&gt;"\r\n"&lt;/SPAN&gt;);&lt;BR&gt;    &lt;SPAN&gt;for&lt;/SPAN&gt; (&lt;SPAN&gt;int&lt;/SPAN&gt; i=0; i&amp;lt;dr.FieldCount; i++)&lt;BR&gt;    {&lt;BR&gt;        output.Append('&lt;SPAN&gt;"');&lt;BR&gt;        output.Append(dr[i ].ToString());&lt;BR&gt;        output.Append('"&lt;/SPAN&gt;');&lt;BR&gt;        output.Append(&lt;SPAN&gt;"\t"&lt;/SPAN&gt;); &lt;SPAN&gt;// tab-delimited&lt;BR&gt;&lt;/SPAN&gt;    }&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;that should do the trick&lt;BR&gt;&lt;/PRE&gt;</description></item><item><title>export database records to tab delimited file. asp.net/vb</title><link>http://forums.asp.net/thread/1087288.aspx</link><pubDate>Wed, 19 Oct 2005 07:21:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1087288</guid><dc:creator>nivram</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1087288.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=1087288</wfw:commentRss><description>&lt;font class="body"&gt; hello everyone.
&lt;br&gt;
&lt;br&gt;I have a small project that need to export a database record stored
in mssql server 2000 to a tab delimited text file. I see some example
in the web but not exactly what i want. &lt;br&gt;
&lt;br&gt;Here is the explanation: (I still dont have a sample program)
&lt;br&gt;
&lt;br&gt;There should be a link for download record. When you click this it
will prompt you to save it to your computer in a txt format. The user
will have option of what filename he/she would choose. Then this
filename will be use to sotore the actual data coming from the
database. I need to do this because this tab-delimited textfile will
then use by our user to upload to another system.
&lt;br&gt;
&lt;br&gt;Please provide an example on how to do this. Additional tutorial site are also welcome.
&lt;br&gt;
&lt;br&gt;thanks
&lt;br&gt;
&lt;br&gt;marvz
&lt;br&gt;
&lt;/font&gt;</description></item></channel></rss>