<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aneef.Net &#187; LINQ</title>
	<atom:link href="http://www.aneef.net/category/dotnet-framework/linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aneef.net</link>
	<description>Do it in .Net way &#124; Blogging about C#,ASP.Net, LINQ,WPF and .Net Technologies</description>
	<lastBuildDate>Mon, 24 May 2010 10:50:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Uploading Binary files or Images using LINQ to SQL</title>
		<link>http://www.aneef.net/2009/01/16/uploading-binary-files-or-images-using-linq-to-sql/</link>
		<comments>http://www.aneef.net/2009/01/16/uploading-binary-files-or-images-using-linq-to-sql/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 09:34:34 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[LINQ]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2009/01/16/uploading-binary-files-or-images-using-linq-to-sql/</guid>
		<description><![CDATA[Today I received an email from a friend, asking how to save a binary file in to the database using LINQ to SQL.  This was the second time a person had asked me the same question, So I thought of having a blog entry about it. Assume that we need to upload a file  and [...]]]></description>
			<content:encoded><![CDATA[<p>Today I received an email from a friend, asking how to save a binary file in to the database using LINQ to SQL.  This was the second time a person had asked me the same question, So I thought of having a blog entry about it.</p>
<p>Assume that we need to upload a file  and save its name, and the file in the database table. so lets see how we do it.</p>
<p><strong>This is my Table</strong></p>
<pre class="csharpcode"><span class="kwrd">CREATE</span> <span class="kwrd">TABLE</span> [dbo].[Files2](
    [ID] [<span class="kwrd">int</span>] <span class="kwrd">IDENTITY</span>(1,1) <span class="kwrd">NOT</span> <span class="kwrd">NULL</span>,
    [FileName] [<span class="kwrd">varchar</span>](50) <span class="kwrd">NOT</span> <span class="kwrd">NULL</span>,
    [FileSource] [image] <span class="kwrd">NOT</span> <span class="kwrd">NULL</span>,
 )
<span class="kwrd">GO</span></pre>
<pre class="csharpcode">And The Following Stored Procedure is used to Insert the Value:</pre>
<pre class="csharpcode"> </pre>
<pre class="csharpcode"><span class="kwrd">CREATE</span> <span class="kwrd">PROCEDURE</span> [dbo].[ADDFILE]
(
    @FILENAME <span class="kwrd">VARCHAR</span>(50),
    @FILESOURCE image
)
<span class="kwrd">AS</span>
<span class="kwrd">SET</span> NOCOUNT <span class="kwrd">ON</span>

INSERT <span class="kwrd">INTO</span> Files([FileName],[FileSource])
<span class="kwrd">VALUES</span>(@FILENAME,@FILESOURCE)</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>And the following code is used to upload and save the file using web form with a text box for file name, and a file upload control to upload the file. on the click event of a button this code is called.</p>
<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">void</span> Button1_Click(<span class="kwrd">object</span> sender, EventArgs e)
{

     <span class="kwrd">if</span> (FileUploader.HasFile &amp;&amp; FileUploader.PostedFile.ContentLength &gt; 0)
      {
          <span class="kwrd">string</span> filename = txtFileName.Text;
          <span class="rem">//Read the file in to a byte Array.</span>
          <span class="kwrd">byte</span>[] filebyte = FileUploader.FileBytes;

    System.Data.Linq.Binary fileBinary = <span class="kwrd">new</span> System.Data.Linq.Binary(filebyte);
          MyDataDataContext MyData = <span class="kwrd">new</span> MyDataDataContext();

          MyData.ADDFILE(filename, fileBinary);
          lblStatus.Text = <span class="str">"File Uploaded Successfully!"</span>;

        }
}</pre>
<pre class="csharpcode"> </pre>
<pre class="csharpcode"> </pre>
<p>The Main thing to remember here is that we need to pass the FileUploader.FileBytes  to the constructor of <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.binary.aspx" target="_blank">System.Data.Linq.Binary</a>.</p>
<p>To Learn more about LINQ to SQL Please visit <a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx" target="_blank">Here</a>.</p>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<pre class="csharpcode"><strong><em> EDIT:</em></strong><em> Richie </em><em>just showed another way to achieve this in his blog </em><a href="http://hengrr.wordpress.com/2009/02/20/linq-to-sql-upload-binary-file/" target="_blank"><em>here</em></a><em>.</em></pre>
<pre class="csharpcode"> </pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-3530459083226419";
/* Image only In POst */
google_ad_slot = "2791845940";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=39&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/01/16/uploading-binary-files-or-images-using-linq-to-sql/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008, C# 3.0, LINQ, ASP.Net 3.5 Getting Started</title>
		<link>http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/</link>
		<comments>http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 07:35:52 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/</guid>
		<description><![CDATA[these days I&#8217;m just playing around with Visual studio 2008 and its new features, C# 3.0 LINQ, Windows Presentation Foundation, Silverlight, ASP.Net 3.5 and much more. And trust me last few months, I have received a lot of emails regarding How to&#8217;s of these and requesting resources to learn these language improvements. well may be [...]]]></description>
			<content:encoded><![CDATA[<p>these days I&#8217;m just playing around with Visual studio 2008 and its new features, <a href="http://msdn2.microsoft.com/en-us/library/bb308966.aspx" target="_blank">C# 3.0</a> <a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx" target="_blank">LINQ</a>, <a href="http://wpf.netfx3.com/" target="_blank">Windows Presentation Foundation</a>, <a href="http://silverlight.net/" target="_blank">Silverlight</a>, ASP.Net 3.5 and much more. And trust me last few months, I have received a lot of emails regarding How to&#8217;s of these and requesting resources to learn these language improvements. well may be you  wonder why I get these requests while there are a lot of geek&#8217;s outs there.. well trust me I do have some fans!!.</p>
<p>so I decided to help them all out, but I don&#8217;t want to fill the blogsphere with another post of LINQ, WPF or WCF, because its already filled with a lot of articles on them by geek&#8217;s and various people around the world.so what I&#8217;m going to do is post some valuable links on where you can give a kick start on learning these.</p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-3530459083226419";
/* testadd */
google_ad_slot = "3104422232";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<ol>
<li>To get visual studio 2008 read the post <a href="http://www.aneef.net/2007/11/23/visual-studio-2008-orcas-is-here/" target="_blank">here</a>.</li>
<li>The first and best place I would recommend to learn is reading Scott Guthrie&#8217;s web blog. he had written some excellent articles on these new technologies. I would recommend you to subscribe his blogs feeds or book marking his blog for future reference. here is are some valuable articles by him.
<ol>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/01/28/video-using-linq-with-asp-net-in-vs-orcas-part-1.aspx" target="_blank">Using LINQ with ASP.Net in VS 2008</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/02/08/my-first-look-at-orcas-presentation.aspx" target="_blank">Scott Guthrie &#8211; First Look at ORCAS</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/03/08/new-c-orcas-language-features-automatic-properties-object-initializers-and-collection-initializers.aspx" target="_blank">New &#8220;ORCAS&#8221; C# 3.0 Language Features: Automatic Properties, Object Initializers and Collection Initializers</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features : Extension Methods</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features : Lambda Expressions</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/04/21/new-orcas-language-feature-query-syntax.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features : Query Syntax</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/15/new-orcas-language-feature-anonymous-types.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features :  Anonymous Types</a>.</li>
<li>and the following are Scott&#8217;s posts on LINQ
<ul>
<li>
<ul>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx">Part 1: Introduction to LINQ to SQL</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx">Part 2: Defining our Data Model Classes</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx">Part 3: Querying our Database</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx">Part 4: Updating our Database</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx">Part 5: Binding UI using the ASP:LinqDataSource Control</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx">Part 6: Retrieving Data Using Stored Procedures</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/23/linq-to-sql-part-7-updating-our-database-using-stored-procedures.aspx">Part 7: Updating our Database using Stored Procedures</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx">Part 8: Executing Custom SQL Expressions</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-expression-with-the-lt-asp-linqdatasource-gt-control.aspx" target="_blank">Part 9: Using a Custom LINQ Expression with the Control</a></li>
</ul>
</li>
</ul>
</li>
</ol>
</li>
<li>Another Place to Learn About LINQ is  <a href="http://linqinaction.net/blogs/default.aspx" target="_blank">LINQ in Action</a> . this site with its popularity has been written as a book  also for more information visit <a href="http://linqinaction.net/blogs/main/archive/2008/02/02/here-it-is-the-linq-in-action-paper-book.aspx" target="_blank">here</a>.</li>
<li>And now for WPF. here are the web sites which helped me to build my WPF knowledge.
<ol>
<li><a href="http://windowsclient.net/learn/videos_wpf.aspx" target="_blank">Windows Client official web site WPF Video Tutorials</a></li>
<li><a href="http://www.contentpresenter.com/" target="_blank">The Content Presenter</a></li>
<li><a href="http://thewpfblog.com/index.php" target="_blank">The WPF Blog</a></li>
</ol>
</li>
<li>And so far to lean <a href="http://www.silverlight.net" target="_blank">Silverlight</a> would recommend the official <a href="http://www.silverlight.net" target="_blank">Silverlight web site</a>.</li>
<li>and below are some more links which you might be interested in:
<ol>
<li><a href="http://blogs.msdn.com/pfxteam/default.aspx" target="_blank">Parallel Language Integrated Query (PLINQ)</a></li>
<li><a href="http://www.asp.net/learn/3.5-videos/" target="_blank">ASP.Net 3.5 Video Tutorials</a>.</li>
<li><a href="http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx" target="_blank">101 LINQ Samples</a>.</li>
<li>Xceed WPF Data Grid Component -<a href="http://xceed.com/Grid_WPF_New.html" target="_blank">Free full Version</a> (1 Developer Licence ).</li>
</ol>
</li>
<li>And finally <a href="http://www.microsoft.com/Downloads/details.aspx?familyid=8BDAA836-0BBA-4393-94DB-6C3C4A0C98A1&amp;displaylang=en" target="_blank">The Official Visual studio 2008 training kit by Microsoft</a></li>
</ol>
<p>Well These are the sites which I visit often to learn about these new technologies. I&#8217;m just sharing these with you to make it easy to find about these and  learn them easily without spending much time to search for these.</p>
<p>I hope it helped you, Enjoy!!.</p>
<img src="http://www.aneef.net/?ak_action=api_record_view&id=20&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
