<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Asp.Net Team's Weblog &#187; C#</title>
	<atom:link href="http://aspnetteam.wordpress.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://aspnetteam.wordpress.com</link>
	<description>Another ASP.NET Weblog</description>
	<lastBuildDate>Thu, 03 Sep 2009 11:54:33 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='aspnetteam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/ea6345954410fcd98c45fab481df7cbf?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Asp.Net Team's Weblog &#187; C#</title>
		<link>http://aspnetteam.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://aspnetteam.wordpress.com/osd.xml" title="Asp.Net Team&#8217;s Weblog" />
		<item>
		<title>Email using C#</title>
		<link>http://aspnetteam.wordpress.com/2009/09/03/email-using-c/</link>
		<comments>http://aspnetteam.wordpress.com/2009/09/03/email-using-c/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 11:50:14 +0000</pubDate>
		<dc:creator>Frank Adams</dc:creator>
				<category><![CDATA[ASP.NET C#]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://aspnetteam.wordpress.com/?p=125</guid>
		<description><![CDATA[I had a co-worker recently ask me what I did to send email from a C# web application. I gave him what worked for me. He made a few adjustments and sent it back to me.  I did request that he send me what he came up with that finally worked for him. I think [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=125&subd=aspnetteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I had a co-worker recently ask me what I did to send email from a C# web application. I gave him what worked for me. He made a few adjustments and sent it back to me.  I did request that he send me what he came up with that finally worked for him. I think he did a better job than I so I am going to post it for you to see. Have a look and see how it may fit into your application or project. Improvements are welcome. He ended up writing a class to call from anywhere in the project. It takes the following arguments; from, to, subject, body, attachments, and isBodyHTML boolean.</p>
<p><code>using System.Net;<br />
using System.Net.Mail;</code></p>
<p><code>public class mailer<br />
{<br />
public Boolean sendemail(String strFrom, string strTo, string strSubject, string strBody, string strAttachmentPath, bool IsBodyHTML)<br />
{<br />
Array arrToArray;<br />
char[] splitter = { ';' };<br />
arrToArray = strTo.Split(splitter);<br />
MailMessage mm = new MailMessage();<br />
mm.From = new MailAddress(strFrom);<br />
mm.Subject = strSubject;<br />
mm.Body = strBody+disclaimer;<br />
mm.IsBodyHtml = IsBodyHTML;<br />
//mm.ReplyTo = new MailAddress("<a href="mailto:replyto@xyz.com">replyto@xyz.com</a>");<br />
foreach (string s in arrToArray)<br />
{<br />
mm.To.Add(new MailAddress(s));<br />
}<br />
if (strAttachmentPath != "")<br />
{<br />
try<br />
{<br />
//Add Attachment<br />
Attachment attachFile = new Attachment(strAttachmentPath);<br />
mm.Attachments.Add(attachFile);<br />
}<br />
catch { }<br />
}<br />
SmtpClient smtp = new SmtpClient();<br />
try<br />
{<br />
smtp.Host = "mail.domain.com";<br />
smtp.Port = 25; //Specify your port No;<br />
smtp.Send(mm);<br />
return true;<br />
}<br />
catch<br />
{<br />
mm.Dispose();<br />
smtp = null;<br />
return false;<br />
}<br />
}<br />
}</code></p>
<p>Thanks Shane!</p>
<p>Hope this helped someone.  Have fun coding and as always, if there are any questions or suggestions, they are welcome.  Thank you.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aspnetteam.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aspnetteam.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aspnetteam.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aspnetteam.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aspnetteam.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aspnetteam.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aspnetteam.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aspnetteam.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aspnetteam.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aspnetteam.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=125&subd=aspnetteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://aspnetteam.wordpress.com/2009/09/03/email-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7de40145b3f1678a34b54c67d2c8e44?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">Frank</media:title>
		</media:content>
	</item>
		<item>
		<title>Working With Dates and Times Using ASP.NET C#</title>
		<link>http://aspnetteam.wordpress.com/2008/12/01/working-with-dates-and-times-using-aspnet-c/</link>
		<comments>http://aspnetteam.wordpress.com/2008/12/01/working-with-dates-and-times-using-aspnet-c/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 19:30:54 +0000</pubDate>
		<dc:creator>Frank Adams</dc:creator>
				<category><![CDATA[ASP.NET C#]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[Formats]]></category>
		<category><![CDATA[Times]]></category>

		<guid isPermaLink="false">http://aspnetteam.wordpress.com/?p=80</guid>
		<description><![CDATA[I know we have all have to use dates at some time or another.  I came across this posting and thought I would list it here for you.  Hope it helps.
DateTime today = DateTime.Today; // just the date
DateTime tomorrow = today.AddDays(1);
DateTime yesterday = today.AddDays(-1);
TimeSpan time = tomorrow &#8211; today;
int days = time.Days;
int hours = time.Hours;
int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=80&subd=aspnetteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I know we have all have to use dates at some time or another.  I came across this posting and thought I would list it here for you.  Hope it helps.</p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#21b183;font-family:Consolas;">DateTime </span><span style="font-size:11pt;color:black;font-family:Consolas;">today = </span><span style="font-size:11pt;color:#21b183;font-family:Consolas;">DateTime</span><span style="font-size:11pt;color:black;font-family:Consolas;">.Today; </span><span style="font-size:11pt;color:#26cd00;font-family:Consolas;">// just the date</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#21b183;font-family:Consolas;">DateTime </span><span style="font-size:11pt;color:black;font-family:Consolas;">tomorrow = today.AddDays(1);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#21b183;font-family:Consolas;">DateTime </span><span style="font-size:11pt;color:black;font-family:Consolas;">yesterday = today.AddDays(-1);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#21b183;font-family:Consolas;">TimeSpan </span><span style="font-size:11pt;color:black;font-family:Consolas;">time = tomorrow &#8211; today;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Consolas;">int </span><span style="font-size:11pt;color:black;font-family:Consolas;">days = time.Days;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Consolas;">int </span><span style="font-size:11pt;color:black;font-family:Consolas;">hours = time.Hours;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Consolas;">int </span><span style="font-size:11pt;color:black;font-family:Consolas;">minutes = time.Minutes;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Consolas;">int </span><span style="font-size:11pt;color:black;font-family:Consolas;">seconds = time.Seconds;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Consolas;">int </span><span style="font-size:11pt;color:black;font-family:Consolas;">milliseconds = time.Milliseconds;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Consolas;">time += </span><span style="font-size:11pt;color:#0f61ff;font-family:Consolas;">new </span><span style="font-size:11pt;color:#21b183;font-family:Consolas;">TimeSpan</span><span style="font-size:11pt;color:black;font-family:Consolas;">(days, hours, minutes, seconds,</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Consolas;">milliseconds);</span></p>
<p><span style="font-size:11pt;font-family:Consolas;">As always, if there are any questions or suggestions, they are welcome. Thank you.</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aspnetteam.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aspnetteam.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aspnetteam.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aspnetteam.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aspnetteam.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aspnetteam.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aspnetteam.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aspnetteam.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aspnetteam.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aspnetteam.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=80&subd=aspnetteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://aspnetteam.wordpress.com/2008/12/01/working-with-dates-and-times-using-aspnet-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7de40145b3f1678a34b54c67d2c8e44?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">Frank</media:title>
		</media:content>
	</item>
		<item>
		<title>Performing Loops &#8211; VB and C#</title>
		<link>http://aspnetteam.wordpress.com/2008/11/17/performing-loops-vb-and-c/</link>
		<comments>http://aspnetteam.wordpress.com/2008/11/17/performing-loops-vb-and-c/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 15:26:46 +0000</pubDate>
		<dc:creator>Frank Adams</dc:creator>
				<category><![CDATA[ASP.NET C#]]></category>
		<category><![CDATA[ASP.NET VB]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Loops]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://aspnetteam.wordpress.com/?p=71</guid>
		<description><![CDATA[This will be a short post. I just wanted to display the differences between C# and VB when performing loops.  See below:
VB:
For i As Integer = 10 To 1 Step -1
Console.WriteLine(i)
If i &#60; 5 Then
Exit For
End If
Next
 
Dim start As Integer = 5
For i As Integer = start To start + 10
Console.WriteLine(i)
Next
 
Dim str As String
Do
str = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=71&subd=aspnetteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Verdana;">This will be a short post. I just wanted to display the differences between C# and VB when performing loops.  See below:</span></p>
<p class="MsoNormal" style="margin:0;"><span style="text-decoration:underline;"><span style="font-size:11pt;color:black;font-family:Tahoma;">VB:</span></span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">For </span><span style="font-size:11pt;color:black;font-family:Tahoma;">i </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">As Integer </span><span style="font-size:11pt;color:black;font-family:Tahoma;">= 10 </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">To </span><span style="font-size:11pt;color:black;font-family:Tahoma;">1 </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Step </span><span style="font-size:11pt;color:black;font-family:Tahoma;">-1</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">Console.WriteLine(i)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">If </span><span style="font-size:11pt;color:black;font-family:Tahoma;">i &lt; 5 </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Then</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Exit For</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">End If</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Next</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Dim </span><span style="font-size:11pt;color:black;font-family:Tahoma;">start </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">As Integer </span><span style="font-size:11pt;color:black;font-family:Tahoma;">= 5</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">For </span><span style="font-size:11pt;color:black;font-family:Tahoma;">i </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">As Integer </span><span style="font-size:11pt;color:black;font-family:Tahoma;">= start </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">To </span><span style="font-size:11pt;color:black;font-family:Tahoma;">start + 10</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">Console.WriteLine(i)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Next</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Dim </span><span style="font-size:11pt;color:black;font-family:Tahoma;">str </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">As String</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Do</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">str = Console.ReadLine()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">Console.WriteLine(str)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Loop Until </span><span style="font-size:11pt;color:black;font-family:Tahoma;">str = </span><span style="font-size:11pt;color:#6e0000;font-family:Tahoma;">&#8220;&#8221;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Do</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">str = Console.ReadLine().Trim()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">If String</span><span style="font-size:11pt;color:black;font-family:Tahoma;">.IsNullOrEmpty(str) </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Then</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Exit Do</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">End If</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">Console.WriteLine(</span><span style="font-size:11pt;color:#6e0000;font-family:Tahoma;">&#8220;You typed:{0}&#8221;</span><span style="font-size:11pt;color:black;font-family:Tahoma;">, str)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Loop</span><span style="font-size:11pt;color:black;font-family:Tahoma;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Dim </span><span style="font-size:11pt;color:black;font-family:Tahoma;">names </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">As String</span><span style="font-size:11pt;color:black;font-family:Tahoma;">() = </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">New String</span><span style="font-size:11pt;color:black;font-family:Tahoma;">() {</span><span style="font-size:11pt;color:#6e0000;font-family:Tahoma;">&#8220;Bob&#8221;</span><span style="font-size:11pt;color:black;font-family:Tahoma;">, </span><span style="font-size:11pt;color:#6e0000;font-family:Tahoma;">&#8220;David&#8221;</span><span style="font-size:11pt;color:black;font-family:Tahoma;">}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">For Each </span><span style="font-size:11pt;color:black;font-family:Tahoma;">name </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">As String In </span><span style="font-size:11pt;color:black;font-family:Tahoma;">names</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;">Console.WriteLine(name)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">Next</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="text-decoration:underline;"><span style="font-size:11pt;color:black;font-family:Tahoma;">C#:</span></span><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">for </span><span style="font-size:11pt;color:black;font-family:Tahoma;">(</span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">int </span><span style="font-size:11pt;color:black;font-family:Tahoma;">i=0; i&lt;10; i++) {}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">while </span><span style="font-size:11pt;color:black;font-family:Tahoma;">(i&lt;10) { i++; }</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">do </span><span style="font-size:11pt;color:black;font-family:Tahoma;">{ i++; } </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">while </span><span style="font-size:11pt;color:black;font-family:Tahoma;">(i&lt;10);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:black;font-family:Tahoma;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">foreach </span><span style="font-size:11pt;color:black;font-family:Tahoma;">(</span><span style="font-size:11pt;color:#21b183;font-family:Tahoma;">ListItem </span><span style="font-size:11pt;color:black;font-family:Tahoma;">item </span><span style="font-size:11pt;color:#0f61ff;font-family:Tahoma;">in </span><span style="font-size:11pt;color:black;font-family:Tahoma;">list.Items) {}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:11pt;font-family:Tahoma;"> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aspnetteam.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aspnetteam.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aspnetteam.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aspnetteam.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aspnetteam.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aspnetteam.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aspnetteam.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aspnetteam.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aspnetteam.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aspnetteam.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=71&subd=aspnetteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://aspnetteam.wordpress.com/2008/11/17/performing-loops-vb-and-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7de40145b3f1678a34b54c67d2c8e44?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">Frank</media:title>
		</media:content>
	</item>
		<item>
		<title>Working With a Database in C#</title>
		<link>http://aspnetteam.wordpress.com/2008/11/12/working-with-a-database-in-c/</link>
		<comments>http://aspnetteam.wordpress.com/2008/11/12/working-with-a-database-in-c/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 19:14:17 +0000</pubDate>
		<dc:creator>Frank Adams</dc:creator>
				<category><![CDATA[ASP.NET C#]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[SQLClient]]></category>

		<guid isPermaLink="false">http://aspnetteam.wordpress.com/?p=66</guid>
		<description><![CDATA[I do not use C# much.  Here is some code I found while browsing the Internet that helps to connect to a database:

using System.Data;
using System.Data.SqlClient;
string cs = @"Data Source=.\SQLEXPRESS;" +
string cs = @"Initial Catalog=NamesDB;" +
string cs = @"Integrated Security=True;";
using (SqlConnection con = new SqlConnection(cs)) {
con.Open();
string sql = "INSERT INTO Names(Name) VALUES(@Name)";
// insert a record
SqlCommand [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=66&subd=aspnetteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I do not use C# much.  Here is some code I found while browsing the Internet that helps to connect to a database:<br />
<code><br />
using System.Data;<br />
using System.Data.SqlClient;<br />
string cs = @"Data Source=.\SQLEXPRESS;" +<br />
string cs = @"Initial Catalog=NamesDB;" +<br />
string cs = @"Integrated Security=True;";<br />
using (SqlConnection con = new SqlConnection(cs)) {<br />
con.Open();<br />
string sql = "INSERT INTO Names(Name) VALUES(@Name)";<br />
// insert a record<br />
SqlCommand cmd1 = new SqlCommand(sql, con);<br />
cmd1.Parameters.Add("@Name", SqlDbType.NVarChar, 100);<br />
cmd1.Parameters["@Name"].Value = "Bob";<br />
cmd1.ExecuteNonQuery();<br />
// insert a second record<br />
cmd1.Parameters["@Name"].Value = "David";<br />
cmd1.ExecuteNonQuery();<br />
// read records<br />
sql = "SELECT * FROM Names";<br />
SqlCommand cmd2 = new SqlCommand(sql, con);<br />
using (SqlDataReader r = cmd2.ExecuteReader()) {<br />
int iName = r.GetOrdinal("Name");<br />
while (r.Read()) {<br />
Console.WriteLine(<br />
r.IsDBNull(iName)?"Null":r.GetString(iName)<br />
);<br />
}<br />
}<br />
// read a single value<br />
sql = "SELECT TOP 1 Name FROM Names";<br />
SqlCommand cmd3 = new SqlCommand(sql, con);<br />
Console.WriteLine(cmd3.ExecuteScalar());<br />
}</code></p>
<p>Good luck and Happy Coding! </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aspnetteam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aspnetteam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aspnetteam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aspnetteam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aspnetteam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aspnetteam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aspnetteam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aspnetteam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aspnetteam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aspnetteam.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=66&subd=aspnetteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://aspnetteam.wordpress.com/2008/11/12/working-with-a-database-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7de40145b3f1678a34b54c67d2c8e44?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">Frank</media:title>
		</media:content>
	</item>
		<item>
		<title>Working With Number in C#</title>
		<link>http://aspnetteam.wordpress.com/2008/10/27/working-with-number-in-c/</link>
		<comments>http://aspnetteam.wordpress.com/2008/10/27/working-with-number-in-c/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 20:54:25 +0000</pubDate>
		<dc:creator>Frank Adams</dc:creator>
				<category><![CDATA[ASP.NET C#]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://aspnetteam.wordpress.com/?p=52</guid>
		<description><![CDATA[int i = 0;
// convert from a string
int i = int.Parse(&#8220;1&#8243;);
// convert froma string and don’t throw exceptions
if (int.TryParse(&#8220;1&#8243;, out i)) {}
i++; // increment by one
i&#8211;; // decrement by one
i += 10; // add 10
i -= 10; // subtract 10
i *= 10; // multiply by 10
i /= 10; // divide by 10
i = checked(i*2) // [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=52&subd=aspnetteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">int </span><span style="font-size:12pt;color:black;font-family:Monaco;">i = 0;</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:12pt;color:#26cd00;font-family:Monaco;"><span style="font-family:Times New Roman;">// convert from a string</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">int </span><span style="font-size:12pt;color:black;font-family:Monaco;">i = </span><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">int</span><span style="font-size:12pt;color:black;font-family:Monaco;">.Parse(</span><span style="font-size:12pt;color:#6e0000;font-family:Monaco;">&#8220;1&#8243;</span><span style="font-size:12pt;color:black;font-family:Monaco;">);</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:12pt;color:#26cd00;font-family:Monaco;"><span style="font-family:Times New Roman;">// convert froma string and don’t throw exceptions</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">if </span><span style="font-size:12pt;color:black;font-family:Monaco;">(</span><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">int</span><span style="font-size:12pt;color:black;font-family:Monaco;">.TryParse(</span><span style="font-size:12pt;color:#6e0000;font-family:Monaco;">&#8220;1&#8243;</span><span style="font-size:12pt;color:black;font-family:Monaco;">, </span><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">out </span><span style="font-size:12pt;color:black;font-family:Monaco;">i)) {}</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i++; </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// increment by one</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i&#8211;; </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// decrement by one</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i += 10; </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// add 10</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i -= 10; </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// subtract 10</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i *= 10; </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// multiply by 10</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i /= 10; </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// divide by 10</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i = </span><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">checked</span><span style="font-size:12pt;color:black;font-family:Monaco;">(i*2) </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// check for over flow</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Times New Roman;"><span style="font-size:12pt;color:black;font-family:Monaco;">i = </span><span style="font-size:12pt;color:#0f61ff;font-family:Monaco;">unchecked</span><span style="font-size:12pt;color:black;font-family:Monaco;">(i*2) </span><span style="font-size:12pt;color:#26cd00;font-family:Monaco;">// ignore over flow</span></span><span style="font-size:12pt;color:black;font-family:Monaco;"></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aspnetteam.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aspnetteam.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aspnetteam.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aspnetteam.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aspnetteam.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aspnetteam.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aspnetteam.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aspnetteam.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aspnetteam.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aspnetteam.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aspnetteam.wordpress.com&blog=4774049&post=52&subd=aspnetteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://aspnetteam.wordpress.com/2008/10/27/working-with-number-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7de40145b3f1678a34b54c67d2c8e44?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">Frank</media:title>
		</media:content>
	</item>
	</channel>
</rss>