<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Upload file into Database</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Upload file into Database</description>
  <pubDate>Mon, 13 Apr 2026 20:16:07 -700</pubDate>
  <lastBuildDate>Tue, 03 Mar 2009 21:48:54 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1105</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Upload file into Database : i tried this,this working fine,is...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1105&amp;PID=3964#3964</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=159" rel="nofollow">vinothvdp</a><br /><strong>Subject:</strong> 1105<br /><strong>Posted:</strong> 03-Mar-2009 at 9:48pm<br /><br />i tried this,this working fine,is this right? <DIV><FONT size=2><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>PersistenceManager</FONT></FONT><FONT size=2> PM = </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>PersistenceManager</FONT></FONT><FONT size=2>.DefaultManager;</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EntityList</FONT></FONT><FONT size=2>&lt;</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2>&gt; ListDatas = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EntityList</FONT></FONT><FONT size=2>&lt;</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2>&gt;();</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> bindingNavigatorAddNewItem_Click(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EventArgs</FONT></FONT><FONT size=2> e)</P><P>{</P><P>ListDatas.Add(</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2>.Create(PM));</P><P>bsFile.MoveLast();</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> Form1_Load(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EventArgs</FONT></FONT><FONT size=2> e)</P><P>{</P><P>ListDatas.ReplaceRange(PM.GetEntities&lt;</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2>&gt;());</P><P>bsFile.DataSource = ListDatas;</P><P>}</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>OpenFileDialog</FONT></FONT><FONT size=2> openFileDialog1 = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>OpenFileDialog</FONT></FONT><FONT size=2>();</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> SelectFileultraButton_Click(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EventArgs</FONT></FONT><FONT size=2> e)</P><P>{</P><P>openFileDialog1.Filter = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"All Files (*.*)|*.*"</FONT></FONT><FONT size=2>;</P><P>openFileDialog1.Title = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Select File"</FONT></FONT><FONT size=2>;</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>DialogResult</FONT></FONT><FONT size=2>.Cancel == openFileDialog1.ShowDialog())</P><P>{</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2>;</P><P>}</P><P>fileNameUltraTextEditor.Text = openFileDialog1.FileName;</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> fileName = </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Path</FONT></FONT><FONT size=2>.GetFileName(fileNameUltraTextEditor.Text.ToString());</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>byte</FONT></FONT><FONT size=2>&#091;&#093; content = ReadFileToByteArray(fileName);</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2> CurrentFile = bsFile.Current </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>as</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2>;</P><P>CurrentFile.File= content;</P><P>CurrentFile.FileName = fileName;</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>protected</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>static</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>byte</FONT></FONT><FONT size=2>&#091;&#093; ReadFileToByteArray(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> fileName)</P><P>{</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileStream</FONT></FONT><FONT size=2> fileStream = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileStream</FONT></FONT><FONT size=2>(fileName, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileMode</FONT></FONT><FONT size=2>.OpenOrCreate, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileAccess</FONT></FONT><FONT size=2>.Read);</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>long</FONT></FONT><FONT size=2> len;</P><P>len = fileStream.Length;</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Byte</FONT></FONT><FONT size=2>&#091;&#093; fileAsByte = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Byte</FONT></FONT><FONT size=2>&#091;len&#093;;</P><P>fileStream.Read(fileAsByte, 0, fileAsByte.Length);</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>MemoryStream</FONT></FONT><FONT size=2> memoryStream = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>MemoryStream</FONT></FONT><FONT size=2>(fileAsByte);</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> memoryStream.ToArray();</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> saveToolStripButton_Click(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EventArgs</FONT></FONT><FONT size=2> e)</P><P>{</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (PM.HasChanges())</P><P>{</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>try</P></FONT></FONT><FONT size=2><P>{</P><P>PM.SaveChanges();</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>MessageBox</FONT></FONT><FONT size=2>.Show(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Sucessfully saved"</FONT></FONT><FONT size=2>);</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>catch</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Exception</FONT></FONT><FONT size=2> ex)</P><P>{</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>MessageBox</FONT></FONT><FONT size=2>.Show(ex.Message.ToString());</P><P>}</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</P></FONT></FONT><FONT size=2><P>{</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>MessageBox</FONT></FONT><FONT size=2>.Show(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Nothing to save"</FONT></FONT><FONT size=2>);</P><P>}</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> RetriveultraButton_Click(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>EventArgs</FONT></FONT><FONT size=2> e)</P><P>{</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> fileName = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>.Empty;</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>byte</FONT></FONT><FONT size=2>&#091;&#093; content = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>null</FONT></FONT><FONT size=2>;</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2> CurrentFile = bsFile.Current </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>as</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>ImageUpload</FONT></FONT><FONT size=2>;</P><P>fileName = CurrentFile.FileName;</P><P>content = CurrentFile.File;</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>DirectoryInfo</FONT></FONT><FONT size=2> di = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>DirectoryInfo</FONT></FONT><FONT size=2>(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"C:\\Test"</FONT></FONT><FONT size=2>);</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (di.Exists == </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>false</FONT></FONT><FONT size=2>)</P><P>{</P><P>di.Create();</P><P>}</P><P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileStream</FONT></FONT><FONT size=2> fs = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileStream</FONT></FONT><FONT size=2>(di + </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"\\"</FONT></FONT><FONT size=2> + fileName, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>FileMode</FONT></FONT><FONT size=2>.Create);</P><P>fs.Write(content, 0, System.</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Convert</FONT></FONT><FONT size=2>.ToInt32(content.Length));</P><P>fs.Seek(0, </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>SeekOrigin</FONT></FONT><FONT size=2>.Begin);</P><P>fs.Close();</P><P>}</P></FONT></DIV>]]>
   </description>
   <pubDate>Tue, 03 Mar 2009 21:48:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1105&amp;PID=3964#3964</guid>
  </item> 
  <item>
   <title>Upload file into Database : This would appear to be a SQL...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1105&amp;PID=3959#3959</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 1105<br /><strong>Posted:</strong> 03-Mar-2009 at 8:41am<br /><br />This would appear to be&nbsp; a SQL Server issue involving storing and retrieving of data, not an IdeaBlade issue involving storing amd retrieving of Business Entities.]]>
   </description>
   <pubDate>Tue, 03 Mar 2009 08:41:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1105&amp;PID=3959#3959</guid>
  </item> 
  <item>
   <title>Upload file into Database : Hi sir,  I am using SQL server...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1105&amp;PID=3951#3951</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=159" rel="nofollow">vinothvdp</a><br /><strong>Subject:</strong> 1105<br /><strong>Posted:</strong> 28-Feb-2009 at 9:09pm<br /><br /><P>Hi sir,</P><DIV><P =Ms&#111;normal style="MARGIN: 0in 1.7pt 0pt"><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-: EN">I am using SQL server 2005, how to store and retrieve. Xls,. Doc,. PDF,. jpg ,.bmp file into database, can you give some me examples.</P><DIV>&nbsp;</DIV><DIV><DIV></DIV><DIV></DIV>Thank you,</SPAN></DIV></DIV>]]>
   </description>
   <pubDate>Sat, 28 Feb 2009 21:09:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1105&amp;PID=3951#3951</guid>
  </item> 
 </channel>
</rss>