<?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>Now Eating &#187; Programming</title>
	<atom:link href="http://www.noweating.com/category/software/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.noweating.com</link>
	<description>What are you eating now?</description>
	<lastBuildDate>Fri, 03 Sep 2010 07:52:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP MySQL Chinese characters returned ??????</title>
		<link>http://www.noweating.com/2008/11/php-mysql-chinese-characters-returned/</link>
		<comments>http://www.noweating.com/2008/11/php-mysql-chinese-characters-returned/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 17:05:09 +0000</pubDate>
		<dc:creator>Waco</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.wacofx.com/?p=722</guid>
		<description><![CDATA[If you are dealing with Chinese characters in English environment like me, you will come across some issues with Chinese characters, such as it becomes symbols or lots of question marks (??????) after retrieving. Here&#8217;s the solution on &#8220;question marks&#8221; issue when issuing &#8220;SELECT&#8221; SQL statements. Usually, we issue the following commands to get MySQL [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>If you are dealing with Chinese characters in English environment like me, you will come across some issues with Chinese characters, such as it becomes symbols or lots of question marks (??????) after retrieving. <img src='http://www.noweating.com/wp-content/plugins/smilies-themer/onionhead/onion33.gif' alt=':???' class='wp-smiley' /> Here&#8217;s the solution on &#8220;question marks&#8221; issue when issuing &#8220;SELECT&#8221; SQL statements.</p>
<p><span id="more-722"></span></p>
<p>Usually, we issue the following commands to get MySQL from PHP:<br />
<code><br />
$dblink = mysqli_connect("localhost", $username, $password, $database);<br />
$result = mysqli_query($dblink, $query); //in which $query is your SQL statement<br />
</code></p>
<p>To solve the &#8220;question mark&#8221; issue, try add the following two lines before mysqli_query:</p>
<p><code><br />
$dblink = mysqli_connect("localhost", $username, $password, $database);<br />
<strong>mysqli_query($dblink, "SET CHARACTER SET utf8");<br />
mysqli_query($dblink, "SET NAMES 'utf8'");</strong><br />
$result = mysqli_query($dblink, $query);</code></p>
<p>Hope this help and happy programming.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2008/11/php-mysql-chinese-characters-returned/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing value after pressing &#8220;Add to Cart&#8221; button in DataList</title>
		<link>http://www.noweating.com/2008/09/passing-value-after-pressing-add-to-cart-button-in-datalist/</link>
		<comments>http://www.noweating.com/2008/09/passing-value-after-pressing-add-to-cart-button-in-datalist/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 10:38:22 +0000</pubDate>
		<dc:creator>Waco</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.wacofx.com/?p=400</guid>
		<description><![CDATA[One of the advantages of using DataList is that it provide rich format for each row easily. I had been a while since my last development on ASP.Net. One of my readers asked me how to pass the value from rows in which user selected after pressing a button. I then fired up Visual Studio [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>One of the advantages of using DataList is that it provide rich format for each row easily. I had been a while since my last development on ASP.Net. One of my readers asked me how to pass the value from rows in which user selected after pressing a button. I then fired up Visual Studio 2008 again.</p>
<p>Basically, there are two methods: by creating a button at each row, or provide a checkbox at each row, then only a &#8220;submit&#8221; button at the end of the DataList.</p>
<p><a href="http://www.wacofx.com/wp-content/uploads/2008/09/datalist_addtocart.jpg" rel='lytebox[passing-value-after-pressing-add-to-cart-button-in-datalist]'><img class="alignnone size-full wp-image-402" title="datalist_addtocart" src="http://www.wacofx.com/wp-content/uploads/2008/09/datalist_addtocart.jpg" alt="" width="500" height="263" /></a></p>
<p>The following is a portion of the source code, or you can download a sample developed using C# on VS 2008 <a href="http://www.wacofx.com/wp-content/uploads/2008/09/datalist_addtocart.zip">here</a>:</p>
<pre>-------------------------------------------------------</pre>
<pre>&lt;asp:DataList ID="DataList2" runat="server" BorderStyle="Dashed" BorderWidth="1"
        Width="50%"&gt;
        &lt;HeaderTemplate&gt;
            Name
        &lt;/HeaderTemplate&gt;
        &lt;ItemTemplate&gt;
            &lt;asp:CheckBox ID="chkAdd" runat="server" /&gt;
            &lt;asp:HiddenField ID="hidId" runat="server" Value='&lt;%#  DataBinder.Eval(Container.DataItem,"Id") %&gt;' /&gt;
            &lt;%# DataBinder.Eval(Container.DataItem,"Name") %&gt;
            ($&lt;%# Convert.ToDecimal(DataBinder.Eval(Container.DataItem, "Price")).ToString("0.00") %&gt;)
        &lt;/ItemTemplate&gt;
    &lt;/asp:DataList&gt;
    &lt;asp:Button ID="btnAddToCart2" Text="Add To Cart" runat="server" CommandName="addtocart2"
        OnCommand="DataList2_ItemCommand" /&gt;
    &lt;br /&gt;
    You are adding the following items ID:
    &lt;asp:Label ID="lblCartItem" runat="server"&gt;&lt;/asp:Label&gt;
-------------------------------------------------------
public void DataList2_ItemCommand(object source, System.Web.UI.WebControls.CommandEventArgs e)
    {
        string sId="";
        foreach (DataListItem dli in DataList2.Items)
        {
            CheckBox currChk = (CheckBox)dli.FindControl("chkAdd");
            if (currChk.Checked == true)
            {
                HiddenField currId = (HiddenField)dli.FindControl("hidId");
                sId += currId.Value + ", ";
            }
        }
        lblCartItem.Text = sId;
    }</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2008/09/passing-value-after-pressing-add-to-cart-button-in-datalist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chinese Lunar Calendar Added</title>
		<link>http://www.noweating.com/2008/09/chinese-lunar-calendar-added/</link>
		<comments>http://www.noweating.com/2008/09/chinese-lunar-calendar-added/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 12:02:12 +0000</pubDate>
		<dc:creator>Waco</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.wacofx.com/?p=321</guid>
		<description><![CDATA[I am not a vegetarian but I like to go to vegetarian shops for lunch during weekday. Reasons are it is healthier (to control my cholesterol and liver index) and I am less likely to fall asleep in the afternoon if I took it. However,  I found that it is difficult to know when is [...]


Related posts:<ol><li><a href='http://www.noweating.com/2009/01/comment-notification-added/' rel='bookmark' title='Permanent Link: Comment Notification Added'>Comment Notification Added</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I am not a vegetarian but I like to go to vegetarian shops for lunch during weekday. Reasons are it is healthier (to control my cholesterol and liver index) and I am less likely to fall asleep in the afternoon if I took it. However,  I found that it is difficult to know when is first day (初一)and mid (十五) of Chinese lunar month, so that I won&#8217;t crash with those true vegetarians rushing for vegetables on both days. Most vegetarian shops are extremely crowded on the days. Sadly, most of the calendar available on the Internet only support western calendar.</p>
<p><a href="http://www.wacofx.com/wp-content/uploads/2008/09/calendar.jpg" rel='lytebox[chinese-lunar-calendar-added]'><img class="alignnone size-medium wp-image-325" title="calendar" src="http://www.wacofx.com/wp-content/uploads/2008/09/calendar.jpg" alt="" width="272" height="243" /></a></p>
<p>After searching and developing for weeks, finally I came out with a Chinese lunar calendar and put it on the right panel. Hope it is functioning probably. With this calendar, I will know when is the next &#8220;first day&#8221; and mid of the month so that I WON&#8217;T eat vegetables on that day. <strong>MUAHAHA</strong>:twisted:</p>
<p>P/S: Lunar calendar also used to determine high tide period as well as moon phase. It is good for fishermen.</p>


<p>Related posts:<ol><li><a href='http://www.noweating.com/2009/01/comment-notification-added/' rel='bookmark' title='Permanent Link: Comment Notification Added'>Comment Notification Added</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2008/09/chinese-lunar-calendar-added/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: &#8220;Text/Diff/Renderer/inline.php on line 17&#8243; error</title>
		<link>http://www.noweating.com/2008/08/wordpress-textdiffrendererinlinephp-on-line-17-error/</link>
		<comments>http://www.noweating.com/2008/08/wordpress-textdiffrendererinlinephp-on-line-17-error/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 02:15:59 +0000</pubDate>
		<dc:creator>Waco</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.wacofx.com/?p=127</guid>
		<description><![CDATA[Today I had been buzzed with a bug in WordPress 2.6. That is, one of my posts cannot be loaded when trying to edit it. The page only shows some headers and the rest is empty. As a result, I can&#8217;t edit the post. Checked error log and I found this fatal error: [error] PHP [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Today I had been buzzed with a bug in WordPress 2.6. That is, one of my posts cannot be loaded when trying to edit it. The page only shows some headers and the rest is empty. As a result, I can&#8217;t edit the post. Checked error log and I found this fatal error:</p>
<p><code><br />
[error] PHP Fatal error:  require_once() [<a href="function.require">function.require</a>]: Failed opening required '/Text/Diff/Renderer.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/wacofx/php') in /somedir/wp-includes/Text/Diff/Renderer/inline.php on line 17<br />
[error] PHP Warning:  require_once(/wp-includesText/Diff/Renderer.php) [<a href="function.require-once">function.require-once</a>]: failed to open stream: No such file or directory in /somedir/wp-includes/Text/Diff/Renderer/inline.php on line 17<br />
</code></p>
<p>Googled around and finally found a <a href="http://www.code-styling.de/english/wordpress-26-and-the-textdiff-fatal-errors" target="_blank">solution</a>. Apparently it has sometime to do with ini_set() and some codes in some files need to be modified. The expert also uploaded the modified files or you can download a copy <a href="http://www.wacofx.com/wp-content/uploads/2008/08/wp-includes-wp-260.zip">here</a>.</p>
<p>Another solution can be found <a href="http://www.wacdesigns.com/2008/08/02/fatal-error-require_once-functionrequire-failed-opening-required-textdiffrendererphp/" target="_blank">here</a>.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2008/08/wordpress-textdiffrendererinlinephp-on-line-17-error/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;Database not supported&#8221; appears when installing Zen Cart</title>
		<link>http://www.noweating.com/2007/05/database-not-supported-appears-when-installing-zen-cart/</link>
		<comments>http://www.noweating.com/2007/05/database-not-supported-appears-when-installing-zen-cart/#comments</comments>
		<pubDate>Wed, 09 May 2007 05:16:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://localhost:8080/wordpress/?p=21</guid>
		<description><![CDATA[On Windows XP, after installing Apache HTTP Server 2.2.4, PHP 5.2.2, and MySQL Community Edition 5.0.37, I downloaded Zen Cart &#8211; an open-source PHP e-commerce web application as my friend is asking whether I can develop one for her. I encountered a database not supported error when installing it. After searching through Internet, eventually I [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>On Windows XP, after installing Apache HTTP Server 2.2.4, PHP 5.2.2, and MySQL Community Edition 5.0.37, I downloaded Zen Cart &#8211; an open-source PHP e-commerce web application as my friend is asking whether I can develop one for her. I encountered a database not supported error when installing it. After searching through Internet, eventually I solved the problem by using the following steps:</p>
<p><span id="more-21"></span></p>
<p>1. Download mysqli and mysql connector for PHP from http://dev.mysql.com/downloads/connector/php/</p>
<p>2. Extract both zip files and copy to C:\Program Files\PHP\extension (create &#8220;extension&#8221; folder if it&#8217;s not there). &#8220;extension&#8221; folder should contain &#8220;libmysql.dll&#8221;, &#8220;php_mysqli.dll&#8221;, and &#8220;php_mysql.dll&#8221;.</p>
<p>3. Open &#8220;php.ini&#8221; from C:\Program File\PHP.</p>
<p>4. Change extension_dir to extension_dir = &#8220;c:\program files\php\extension&#8221;</p>
<p>5. Ensure the following statements is in php.ini:</p>
<p>extension=php_mysql.dll<br />
extension=php_mysqli.dll</p>
<p>6. Restart Apache.</p>
<p>7. Re-run Zen Cart installation wizard. Zen Cart should be installed without any error by now.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2007/05/database-not-supported-appears-when-installing-zen-cart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning ASP.Net AJAX (2)</title>
		<link>http://www.noweating.com/2006/12/learning-aspnet-ajax-2/</link>
		<comments>http://www.noweating.com/2006/12/learning-aspnet-ajax-2/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 02:52:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://localhost:8080/wordpress/?p=18</guid>
		<description><![CDATA[After letting ASP.Net Web Administration configured my web.config. I received &#8220;sys is undefined&#8221; error on the page whenever there is AJAX control on the page. There is nothing wrong with the code. All you need to do is to ensure the following statements exist in web.config: &#60;location path=&#8221;ScriptResource.axd&#8221;&#62; &#60;system.web&#62; &#60;authorization&#62; &#60;allow users=&#8221;*&#8221;/&#62; &#60;/authorization&#62; &#60;/system.web&#62; &#60;/location&#62; [...]


Related posts:<ol><li><a href='http://www.noweating.com/2006/11/learning-aspnet-ajax-1/' rel='bookmark' title='Permanent Link: Learning ASP.Net AJAX (1)'>Learning ASP.Net AJAX (1)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>After letting ASP.Net Web Administration configured my web.config. I received &#8220;sys is undefined&#8221; error on the page whenever there is AJAX control on the page. There is nothing wrong with the code. All you need to do is to ensure the following statements exist in web.config:</p>
<p>&lt;location path=&#8221;ScriptResource.axd&#8221;&gt;<br />
&lt;system.web&gt;<br />
&lt;authorization&gt;<br />
&lt;allow users=&#8221;*&#8221;/&gt;<br />
&lt;/authorization&gt;<br />
&lt;/system.web&gt;<br />
&lt;/location&gt;</p>
<p>&lt;add verb=&#8221;GET&#8221; path=&#8221;ScriptResource.axd&#8221; type=&#8221;Microsoft.Web.Handlers.ScriptResourceHandler&#8221; validate=&#8221;false&#8221;/#62</p>
<p>Here is the related link:</p>
<p>http://blogs.wdevs.com/sebastien.lachance/archive/2006/11/23/17758.aspx</p>


<p>Related posts:<ol><li><a href='http://www.noweating.com/2006/11/learning-aspnet-ajax-1/' rel='bookmark' title='Permanent Link: Learning ASP.Net AJAX (1)'>Learning ASP.Net AJAX (1)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2006/12/learning-aspnet-ajax-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to call a JavaScript function when asp:button is clicked</title>
		<link>http://www.noweating.com/2006/12/how-to-call-a-javascript-function-when-aspbutton-is-clicked/</link>
		<comments>http://www.noweating.com/2006/12/how-to-call-a-javascript-function-when-aspbutton-is-clicked/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 02:43:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://localhost:8080/wordpress/?p=17</guid>
		<description><![CDATA[Create an asp:button namely &#8220;button1&#8243;. On codebehind page, add the following: private void Page_Load(object sender, System.EventArgs e) { button1.Attributes.Add(&#8220;onclick&#8221;, &#8220;jsFunc()&#8221;); } in which &#8220;jsFunc&#8221; is the JavaScript function you define in aspx page. With this, whenever button1 is clicked, &#8220;jsFunc&#8221; is called at client side. No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Create an asp:button namely &#8220;button1&#8243;.</p>
<p>On codebehind page, add the following:</p>
<p>private void Page_Load(object sender, System.<a href="http://www.dotnet247.com/247reference/System/EventArgs.aspx">EventArgs</a> e)<br />
{<br />
button1.Attributes.Add(&#8220;onclick&#8221;, &#8220;jsFunc()&#8221;);<br />
}</p>
<p>in which &#8220;jsFunc&#8221; is the JavaScript function you define in aspx page. With this, whenever button1 is clicked, &#8220;jsFunc&#8221; is called at client side.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2006/12/how-to-call-a-javascript-function-when-aspbutton-is-clicked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find a control in a DataList?</title>
		<link>http://www.noweating.com/2006/11/how-to-find-a-control-in-a-datalist/</link>
		<comments>http://www.noweating.com/2006/11/how-to-find-a-control-in-a-datalist/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 12:23:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://localhost:8080/wordpress/?p=16</guid>
		<description><![CDATA[Reference: http://forums.asp.net/1072828/ShowPost.aspx Because DataList is databound control which repeats its item template as many times as there are rows in the data source to it. Therefore contents of template are wrapped into DataList&#8217;s Items (one DataList item per row in data source) which is a naming container to its contents (to keep control ID naming [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Reference: <a href="http://forums.asp.net/1072828/ShowPost.aspx">http://forums.asp.net/1072828/ShowPost.aspx</a></p>
<p>Because DataList is databound control which repeats its item template as many times as there are rows in the data source to it. Therefore contents of template are wrapped into DataList&#8217;s Items (one DataList item per row in data source) which is a naming container to its contents (to keep control ID naming scope unique with repeated controls)</p>
<p>You&#8217;d need to note that to locate a specific Label control, you&#8217;d first need to locate specific dataList item, and run FindControl to it (for example DataList1.Items(0).FindControl(&#8220;label2&#8243;) ), and considering the databound nature, you&#8217;d probably want to loop through all items in the DataList&#8217;s Items collection to get to the every Label control. instead of getting to one on specific row.</p>
<p>Iterating through all items in DataList</p>
<p><span style="font-weight: bold;">VB</span><br />
For Each dli as DataListItem in DataList1.Items<br />
Dim currLbl As Label=DirectCast(dli.FindControl(&#8220;label2&#8243;),Label)<br />
&#8216;&#8230;<br />
Next</p>
<p><span style="font-weight: bold;">C#</span><br />
foreach(DataListItem dli in DataList1.Items)<br />
{<br />
Label currLbl = (Label) dli.FindControl(&#8220;label2&#8243;);<br />
//&#8230;<br />
}</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2006/11/how-to-find-a-control-in-a-datalist/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eval method and ASP.Net expression</title>
		<link>http://www.noweating.com/2006/11/eval-method-and-aspnet-expression/</link>
		<comments>http://www.noweating.com/2006/11/eval-method-and-aspnet-expression/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 06:07:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://localhost:8080/wordpress/?p=15</guid>
		<description><![CDATA[Normally we use to Eval method to print out value retrieved from database to HTML. For example: asp:Label id=&#8221;lblDate&#8221; runat=&#8221;server&#8221; value=&#8217;&#60;%# Eval(myDr["DateAdded"]) &#62;&#8217; Assuming &#8220;DateAdded&#8221; is a date/time field in database, the above statement returns a date/time value from database. Now, if you would like to show only date portion of it. You should define [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Normally we use to Eval method to print out value retrieved from database to HTML. For example:</p>
<p>asp:Label id=&#8221;lblDate&#8221; runat=&#8221;server&#8221; value=&#8217;&lt;%# Eval(myDr["DateAdded"]) &gt;&#8217;</p>
<p>Assuming &#8220;DateAdded&#8221; is a date/time field in database, the above statement returns a date/time value from database.</p>
<p>Now, if you would like to show only date portion of it. You should define format string within Eval, such as:</p>
<p>&lt;%# Eval(myDr["DateAdded"], {0:d}) &gt;</p>
<p>As mentioned in help file, the Eval function is used to define one-way (read-only) binding. There is another method called Bind, which is two-ways. We used &lt;%# %&gt; as data-binding expression. Another expression frequently used is &lt;%$ %&gt;, in which I normally use it to get keyword value from web.config, such as &lt;%$ ConnectionStrings:myConnString %&gt;.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2006/11/eval-method-and-aspnet-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>There is not FOR loop in SQL Server</title>
		<link>http://www.noweating.com/2006/11/there-is-not-for-loop-in-sql-server/</link>
		<comments>http://www.noweating.com/2006/11/there-is-not-for-loop-in-sql-server/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 02:46:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://localhost:8080/wordpress/?p=14</guid>
		<description><![CDATA[In case you still didn&#8217;t aware, there is no FOR loop in Transact-SQL (T-SQL). Anyway, you can replace it with WHILE loop, such as: DECLARE @i int WHILE(@i &#60; 5) BEGIN &#8211; do whatever you want here &#8211; SET @i = @i + 1 END Remember to increment/decrement the counter. Else, you will ended up [...]


Related posts:<ol><li><a href='http://www.noweating.com/2006/07/server-application-unavailable/' rel='bookmark' title='Permanent Link: Server Application Unavailable'>Server Application Unavailable</a></li>
<li><a href='http://www.noweating.com/2006/06/ms-sql-server-2005-express-edition-adventure-1/' rel='bookmark' title='Permanent Link: MS SQL Server 2005 Express Edition Adventure (1)'>MS SQL Server 2005 Express Edition Adventure (1)</a></li>
<li><a href='http://www.noweating.com/2006/10/ms-sql-server-2005-express-edition-adventure-2/' rel='bookmark' title='Permanent Link: MS SQL Server 2005 Express Edition Adventure (2)'>MS SQL Server 2005 Express Edition Adventure (2)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In case you still didn&#8217;t aware, there is no FOR loop in Transact-SQL (T-SQL). Anyway, you can replace it with WHILE loop, such as:</p>
<p>DECLARE @i int</p>
<p>WHILE(@i &lt; 5)<br />
BEGIN<br />
&#8211; do whatever you want here &#8211;<br />
SET @i = @i + 1<br />
END</p>
<p>Remember to increment/decrement the counter. Else, you will ended up in infinite loop.</p>


<p>Related posts:<ol><li><a href='http://www.noweating.com/2006/07/server-application-unavailable/' rel='bookmark' title='Permanent Link: Server Application Unavailable'>Server Application Unavailable</a></li>
<li><a href='http://www.noweating.com/2006/06/ms-sql-server-2005-express-edition-adventure-1/' rel='bookmark' title='Permanent Link: MS SQL Server 2005 Express Edition Adventure (1)'>MS SQL Server 2005 Express Edition Adventure (1)</a></li>
<li><a href='http://www.noweating.com/2006/10/ms-sql-server-2005-express-edition-adventure-2/' rel='bookmark' title='Permanent Link: MS SQL Server 2005 Express Edition Adventure (2)'>MS SQL Server 2005 Express Edition Adventure (2)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.noweating.com/2006/11/there-is-not-for-loop-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
