<?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>RedSouljaz Blog &#187; VB.NET</title>
	<atom:link href="http://redsouljaz.com/tag/vb-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://redsouljaz.com</link>
	<description>My Personal Blog&#039;s</description>
	<lastBuildDate>Mon, 25 Apr 2011 09:17:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VB.NET &#8211; ASP.NET communication between user control and web page using event handler</title>
		<link>http://redsouljaz.com/2011/04/21/vb-net-asp-net-communication-between-user-control-and-web-page-using-event-handler/</link>
		<comments>http://redsouljaz.com/2011/04/21/vb-net-asp-net-communication-between-user-control-and-web-page-using-event-handler/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 10:09:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ascx]]></category>
		<category><![CDATA[Event Driven Communication]]></category>
		<category><![CDATA[event handler]]></category>
		<category><![CDATA[eventargs]]></category>
		<category><![CDATA[EventHandler]]></category>
		<category><![CDATA[handler]]></category>
		<category><![CDATA[handles]]></category>
		<category><![CDATA[raise event]]></category>
		<category><![CDATA[raiseevent]]></category>
		<category><![CDATA[user control]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[VB.NET - ASP.NET communication between user control and web page using event handler]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=379</guid>
		<description><![CDATA[In this post, we want to show how button in user control communicate with web page in asp.net
First create user control called button.ascx.
Add 3 button, name it btnSave, btnEdit and btnCancel.
in button.ascx back code, add this code:

Public Partial Class button
    Inherits System.Web.UI.UserControl
    Public Event btnSaveHandler As System.EventHandler
   [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, we want to show how button in user control communicate with web page in asp.net</p>
<p>First create user control called button.ascx.</p>
<p>Add 3 button, name it btnSave, btnEdit and btnCancel.</p>
<p>in button.ascx back code, add this code:</p>
<pre class="brush: vb;">
Public Partial Class button
    Inherits System.Web.UI.UserControl
    Public Event btnSaveHandler As System.EventHandler
    Public Event btnEditHandler As System.EventHandler
    Public Event btnCancelHandler As System.EventHandler

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
        RaiseEvent btnSaveHandler(Me, New EventArgs())
    End Sub

    Protected Sub btnEdit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEdit.Click
        RaiseEvent btnEditHandler(Me, New EventArgs())
    End Sub

    Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click
        RaiseEvent btnCancelHandler(Me, New EventArgs())
    End Sub
End Class
</pre>
<p>In Default.aspx, add 1 label called label1, then drag the button.ascx to the default.aspx.<br />
Add code in default.aspx as below:</p>
<pre class="brush: vb;">
Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Label1.Text = Request.QueryString(&quot;label&quot;)
        AddHandler button1.btnCancelHandler, AddressOf cancelClick
        AddHandler button1.btnEditHandler, AddressOf editClick
        AddHandler button1.btnSaveHandler, AddressOf saveClick
    End Sub

    Private Sub cancelClick(ByVal sender As Object, ByVal e As EventArgs)
        Response.Redirect(&quot;default.aspx?label=Cancel&quot;)
    End Sub

    Private Sub editClick(ByVal sender As Object, ByVal e As EventArgs)
        Response.Redirect(&quot;default.aspx?label=Edit&quot;)
    End Sub

    Private Sub saveClick(ByVal sender As Object, ByVal e As EventArgs)
        Response.Redirect(&quot;default.aspx?label=Save&quot;)
    End Sub
End Class
</pre>
<p>Run it, you will see that button that we create in user control can be manipulate and used in default.aspx<br />
See other example for communication between user control and page in:<br />
http://www.codeproject.com/KB/user-controls/Page_UserControl.aspx</p>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2011/04/21/vb-net-asp-net-communication-between-user-control-and-web-page-using-event-handler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get first day of the month and last day of the month in VB.NET</title>
		<link>http://redsouljaz.com/2010/06/03/get-first-day-of-the-month-and-last-day-of-the-month-in-vb-net/</link>
		<comments>http://redsouljaz.com/2010/06/03/get-first-day-of-the-month-and-last-day-of-the-month-in-vb-net/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 09:31:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Finding the first and last day of the month]]></category>
		<category><![CDATA[first day of the month]]></category>
		<category><![CDATA[Get first day of the month and last day of the month in VB.NET]]></category>
		<category><![CDATA[last day of the month]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=325</guid>
		<description><![CDATA[This code show how to get first date of the month and last day of the month date.

Private Function GetFirstDayOfMonth(ByVal dtDate As DateTime) As DateTime
        Dim dtFrom As DateTime = dtDate
        dtFrom = dtFrom.AddDays(-(dtFrom.Day - 1))
      [...]]]></description>
			<content:encoded><![CDATA[<p>This code show how to get first date of the month and last day of the month date.</p>
<pre class="brush: vb;">
Private Function GetFirstDayOfMonth(ByVal dtDate As DateTime) As DateTime
        Dim dtFrom As DateTime = dtDate
        dtFrom = dtFrom.AddDays(-(dtFrom.Day - 1))
        Return dtFrom
    End Function

    Private Function GetLastDayOfMonth(ByVal dtDate As DateTime) As DateTime
        Dim dtTo As New DateTime(dtDate.Year, dtDate.Month, 1)
        dtTo = dtTo.AddMonths(1)
        dtTo = dtTo.AddDays(-(dtTo.Day))
        Return dtTo
    End Function

'if you put code like:
GetFirstDayOfMonth(&quot;2010-05-05&quot;) ' It will return = 2010-05-01
GetLastDayOfMonth(&quot;2010-05-05&quot;) ' It will return = 2010-05-31
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/06/03/get-first-day-of-the-month-and-last-day-of-the-month-in-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET Set Data Table to CSV File</title>
		<link>http://redsouljaz.com/2010/06/03/vb-net-set-data-table-to-csv-file/</link>
		<comments>http://redsouljaz.com/2010/06/03/vb-net-set-data-table-to-csv-file/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 09:22:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Data Table to CSV]]></category>
		<category><![CDATA[datatable 2 csv]]></category>
		<category><![CDATA[DataTable to CSV]]></category>
		<category><![CDATA[Set Data Table to CSV File]]></category>
		<category><![CDATA[VB.NET Set Data Table to CSV File]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=323</guid>
		<description><![CDATA[This function show how to Convert DataTable to CSV File 

    Sub SetDataTable_To_CSV(ByVal dtable As DataTable, ByVal path_filename As String, ByVal sep_char As String)
        Dim writer As System.IO.StreamWriter
        Try
          [...]]]></description>
			<content:encoded><![CDATA[<p>This function show how to Convert DataTable to CSV File </p>
<pre class="brush: vb;">
    Sub SetDataTable_To_CSV(ByVal dtable As DataTable, ByVal path_filename As String, ByVal sep_char As String)
        Dim writer As System.IO.StreamWriter
        Try
            writer = New System.IO.StreamWriter(path_filename)

            Dim _sep As String = &quot;&quot;
            Dim builder As New System.Text.StringBuilder
            For Each col As DataColumn In dtable.Columns
                builder.Append(_sep).Append(col.ColumnName)
                _sep = sep_char
            Next
            writer.WriteLine(builder.ToString())

            For Each row As DataRow In dtable.Rows
                _sep = &quot;&quot;
                builder = New System.Text.StringBuilder

                For Each col As DataColumn In dtable.Columns
                    builder.Append(_sep).Append(row(col.ColumnName))
                    _sep = sep_char
                Next
                writer.WriteLine(builder.ToString())
            Next
        Catch ex As Exception

        Finally
            If Not writer Is Nothing Then writer.Close()
        End Try
    End Sub
</pre>
<p>This is how you use it</p>
<pre class="brush: vb;">
Dim dt As New DataTable
SetDataTable_To_CSV(dt, &quot;C:\test.csv&quot;, &quot;,&quot;)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/06/03/vb-net-set-data-table-to-csv-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VB.NET Date Time Format Patterns</title>
		<link>http://redsouljaz.com/2010/01/15/vb-net-date-time-format-patterns/</link>
		<comments>http://redsouljaz.com/2010/01/15/vb-net-date-time-format-patterns/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 03:00:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Date Time Format Patterns]]></category>
		<category><![CDATA[datetime format]]></category>
		<category><![CDATA[datetime format patterns]]></category>
		<category><![CDATA[VB.NET Date Time Format Patterns]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=301</guid>
		<description><![CDATA[
 Standard Format Example List:



Format
Code
Result


MM/dd/yyyy
Date.Now().ToString(&#8221;d&#8221;)
1/15/2010


dddd, dd MMMM yyyy
Date.Now().ToString(&#8221;D&#8221;)
Friday, January 15, 2010


dddd, dd MMMM yyyy hh:mm	 tt
Date.Now().ToString(&#8221;f&#8221;)
Friday, January 15, 2010 11:06 AM


dddd, dd MMMM yyyy HH:mm:ss
Date.Now().ToString(&#8221;F&#8221;)
Friday, January 15, 2010 11:06:46 AM


MM/dd/yyyy h:mm tt
Date.Now().ToString(&#8221;g&#8221;)
1/15/2010 11:06 AM


MM/dd/yyyy HH:mm:ss
Date.Now().ToString(&#8221;G&#8221;)
1/15/2010 11:06:46 AM


MMMM dd
Date.Now().ToString(&#8221;m&#8221;)
January 15


dd MMM yyyy HH&#8217;:'mm&#8217;:&#8217;ss &#8216;GMT&#8217;
Date.Now().ToString(&#8221;r&#8221;)
Fri, 15 Jan 2010 11:06:46 GMT


yyyy&#8217;-'MM&#8217;-'dd&#8217;T'HH&#8217;:'mm&#8217;:&#8217;ss
Date.Now().ToString(&#8221;s&#8221;)
2010-01-15T11:06:46


yyyy&#8217;-'MM&#8217;-'dd HH&#8217;:'mm&#8217;:&#8217;ss&#8217;Z&#8217;
Date.Now().ToString(&#8221;u&#8221;)
2010-01-15 11:06:46Z


dddd, MMMM dd yyyy HH:mm:ss
Date.Now().ToString(&#8221;U&#8221;)
Friday, January [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.plus500.com/?id=21914&#038;pl=2&#038;tags=" target="_blank" title="Plus500"><img src="http://cdn.plus500.com/Media/Banners/728x90/439.gif" width="728" height="90" border="0" alt="Plus500" /></a></p>
<div><strong> Standard Format Example List:</strong></p>
<table style="width: 100%; height: 243px;" border="1" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="style2"><strong><span style="font-family: Arial; font-size: x-small;">Format</span></strong></td>
<td class="style1"><strong><span style="font-family: Arial; font-size: x-small;">Code</span></strong></td>
<td><strong><span style="font-family: Arial; font-size: x-small;">Result</span></strong></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MM/dd/yyyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;d&#8221;)</span></td>
<td><span id="Label1">1/15/2010</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, dd MMMM yyyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;D&#8221;)</span></td>
<td><span id="Label2">Friday, January 15, 2010</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, dd MMMM yyyy hh:mm	 tt</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;f&#8221;)</span></td>
<td><span id="Label3">Friday, January 15, 2010 11:06 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, dd MMMM yyyy HH:mm:ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;F&#8221;)</span></td>
<td><span id="Label4">Friday, January 15, 2010 11:06:46 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MM/dd/yyyy h:mm tt</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;g&#8221;)</span></td>
<td><span id="Label5">1/15/2010 11:06 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MM/dd/yyyy HH:mm:ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;G&#8221;)</span></td>
<td><span id="Label6">1/15/2010 11:06:46 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MMMM dd</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;m&#8221;)</span></td>
<td><span id="Label7">January 15</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dd MMM yyyy HH&#8217;:'mm&#8217;:&#8217;ss &#8216;GMT&#8217;</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;r&#8221;)</span></td>
<td><span id="Label8">Fri, 15 Jan 2010 11:06:46 GMT</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">yyyy&#8217;-'MM&#8217;-'dd&#8217;T'HH&#8217;:'mm&#8217;:&#8217;ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;s&#8221;)</span></td>
<td><span id="Label9">2010-01-15T11:06:46</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">yyyy&#8217;-'MM&#8217;-'dd HH&#8217;:'mm&#8217;:&#8217;ss&#8217;Z&#8217;</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;u&#8221;)</span></td>
<td><span id="Label10">2010-01-15 11:06:46Z</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, MMMM dd yyyy HH:mm:ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;U&#8221;)</span></td>
<td><span id="Label11">Friday, January 15, 2010 3:06:46 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">yyyy MMMM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;y&#8221;)</span></td>
<td><span id="Label12">January, 2010</span></td>
</tr>
</tbody>
</table>
</div>
<p><span id="more-301"></span><br />
<strong> Custom Format Examples List:</strong></p>
<table style="width: 100%;" border="1" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="style3"><strong><span style="font-family: Arial; font-size: x-small;">DayFormat Value</span></strong></td>
<td class="style1"><strong><span style="font-family: Arial; font-size: x-small;">Sample header</span></strong></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">d</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">day of the month 1 &#8211; 31</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">dd</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">day of the month 01 &#8211; 31</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">ddd</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">abbreviated name of the day of the week  (Mon, Tues, Wed etc)</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">dddd</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Full name of the day of the week (Monday, Tuesday etc)</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">h</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">12-hour clock hour (e.g. 9)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">hh</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">12-hour clock, with a leading 0 (e.g. 09)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">H</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">24-hour clock hour (e.g. 19)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">HH</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">24-hour clock hour, with a leading 0 (e.g. 19)</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">t</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Abbreviated AM / PM (e.g. A or P)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">tt</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">AM / PM</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">y</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Year. eg. 2009 become 9</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">yy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Year. eg. 2009 become 09</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">yyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Year. 2009</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">yyyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Year. 2009</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">K</span></td>
<td class="style1">
<p style="width: 293px;"><span style="font-family: Arial; font-size: x-small;">Represents the time zone information eg. +6:00</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">ss</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Seconds with leading zero</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">m</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Minutes</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">mm</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Minutes with a leading zero</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">M</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Month number 1-12</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">MM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Month number with leading zero 01-12</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">MMM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Abbreviated Month Name (Jan, Feb)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">MMMM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Full month name (January)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">s</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Seconds</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">ss</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Seconds with leading zero</span></p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/01/15/vb-net-date-time-format-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET: How to implement Group By in DataSet using LINQ</title>
		<link>http://redsouljaz.com/2009/12/10/vb-net-how-to-implement-group-by-in-dataset-using-linq/</link>
		<comments>http://redsouljaz.com/2009/12/10/vb-net-how-to-implement-group-by-in-dataset-using-linq/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 04:45:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINQ]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[How to implement Group By in DataSet]]></category>
		<category><![CDATA[implement Group By in DataSet]]></category>
		<category><![CDATA[VB.NET: How to implement Group By in DataSet using LINQ]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=251</guid>
		<description><![CDATA[In this post I will show you the power of LINQ. At first I never try LINQ even when I developing project using Visual Studio 2008. But since I have no way to find a solution to one of my project, I start to explore LINQ which is give me a thought of how powerful and simple it become when doing a coding using LINQ.]]></description>
			<content:encoded><![CDATA[<p>In this post I will show you the power of LINQ. At first I never try LINQ even when I developing project using Visual Studio 2008. But since I have no way to find a solution to one of my project, I start to explore LINQ which is give me a thought of how powerful and simple it become when doing a coding using LINQ.<br />
<span id="more-251"></span><br />
So this is the case, I’m having a dataset with table SalesOrderDetail:</p>
<p><img class="alignleft size-full wp-image-252" title="LINQ1" src="http://redsouljaz.com/wp-content/uploads/2009/12/LINQ1.jpg" alt="LINQ1" width="234" height="137" /></p>
<p>And the data inside is :</p>
<p><img class="alignnone size-full wp-image-253" title="LINQ2" src="http://redsouljaz.com/wp-content/uploads/2009/12/LINQ2.jpg" alt="LINQ2" width="649" height="405" /></p>
<p>The question is, How to sum OrderQty and LineTotal based on SalesOrderID?</p>
<p>Some people might said, why don’t you just group by in store procedure or SQL Query when you calling the database. Of course than can be done easily, but what if you get this data from webservices or from csv / textfile which is make imposible to query it. This is why the LINQ comes in hand to solve this problem (Correct me if im wrong )</p>
<p>How to use LINQ for this case:</p>
<p>First:</p>
<pre class="brush: vb;">
Imports System.Linq
</pre>
<p>Second:</p>
<pre class="brush: vb;">
Public Class Form2

    Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dt As New DataSet1TableAdapters.SalesOrderDetailTableAdapter
        Dim result = From c In dt.GetData() Group c By c.SalesOrderID Into OrderQty = Sum(c.OrderQty), LineTotal = Sum(c.LineTotal) Select SalesOrderID, OrderQty, LineTotal
        Me.DataGridView1.DataSource = result.ToList()
    End Sub

End Class
</pre>
<p>Result:<br />
<img class="alignnone size-full wp-image-254" title="LINQ3" src="http://redsouljaz.com/wp-content/uploads/2009/12/LINQ3.jpg" alt="LINQ3" width="370" height="402" /></p>
<p>So as you can see, at this line:</p>
<pre class="brush: vb;">
Dim result = From c In dt.GetData() Group c By c.SalesOrderID Into OrderQty = Sum(c.OrderQty), LineTotal = Sum(c.LineTotal) Select SalesOrderID, OrderQty, LineTotal
</pre>
<p>Result is the variable of the LINQ output, c is the variable of dt.GetData(), then you gtoup c by salesOrderID into new variable called OrderQty and so on. At the end you select the new variable that already sum / group by.</p>
<p>In order to shows the output to the datagridview, Im using result.ToList(). But there is a problem with this method, the sequnce of the column is based on alphabetical order. Even if I already set in datagridview poperties, it still back to the alphabetical sequence. I hope someone can answer this question.</p>
<p>This example is done in Visual Studio 2008.</p>
<p>If you want to see more detail about LINQ example, this is the good site:</p>
<p><a href="http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx" target="_blank">http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx</a></p>
<p>Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/12/10/vb-net-how-to-implement-group-by-in-dataset-using-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting asp.net to Sql server 2005 stored procedures into dataset</title>
		<link>http://redsouljaz.com/2009/06/10/connecting-asp-net-to-sql-server-2005-stored-procedures-into-dataset/</link>
		<comments>http://redsouljaz.com/2009/06/10/connecting-asp-net-to-sql-server-2005-stored-procedures-into-dataset/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 07:20:30 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[asp.net using dataset call stored procedures]]></category>
		<category><![CDATA[call sql server stored procedure]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[SqlDataReader]]></category>
		<category><![CDATA[stored procedures]]></category>
		<category><![CDATA[stored procedures to dataset]]></category>
		<category><![CDATA[using asp.net to call sql server stored procedure]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=160</guid>
		<description><![CDATA[This article demonstrates how to use ASP.NET and ADO.NET with Visual Basic .NET to create and to call a Microsoft SQL Server stored procedure with an input parameter and an output parameter.]]></description>
			<content:encoded><![CDATA[<p>This article demonstrates how to use ASP.NET and ADO.NET with Visual Basic .NET to create and to call a Microsoft SQL Server stored procedure with an input parameter and an output parameter.</p>
<p>1 step create store procedure</p>
<pre class="brush: css;">

Create Procedure GetAuthorsByLastName1 (@au_lname varchar(40), @RowCount int output)
as

select * from authors where au_lname like @au_lname;

/* @@ROWCOUNT returns the number of rows that are affected by the last statement. */
select @RowCount=@@ROWCOUNT
</pre>
<p>Call the stored procedure in asp.net code<br />
<span id="more-160"></span></p>
<pre class="brush: css;">
  Private Function getDataset() As DataSet
        Dim DS As DataSet
        Dim MyConnection As SqlConnection
        Dim MyDataAdapter As SqlDataAdapter

        'Create a connection to the SQL Server.
        MyConnection = New SqlConnection(&quot;server=(local);database=pubs;Trusted_Connection=yes&quot;)

        'Create a DataAdapter, and then provide the name of the stored procedure.
        MyDataAdapter = New SqlDataAdapter(&quot;GetAuthorsByLastName&quot;, MyConnection)

        'Set the command type as StoredProcedure.
        MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure

        'Create and add a parameter to Parameters collection for the stored procedure.
        MyDataAdapter.SelectCommand.Parameters.Add(New SqlParameter(&quot;@au_lname&quot;, _
       SqlDbType.VarChar, 40))

        'Assign the search value to the parameter.
        MyDataAdapter.SelectCommand.Parameters(&quot;@au_lname&quot;).Value = Trim(txtLastName.Text)

        'Create and add an output parameter to Parameters collection.
        MyDataAdapter.SelectCommand.Parameters.Add(New SqlParameter(&quot;@RowCount&quot;, _
        SqlDbType.Int, 4))

        'Set the direction for the parameter. This parameter returns the Rows returned.
        MyDataAdapter.SelectCommand.Parameters(&quot;@RowCount&quot;).Direction = ParameterDirection.Output

        DS = New DataSet() 'Create a new DataSet to hold the records.
        MyDataAdapter.Fill(DS, &quot;AuthorsByLastName&quot;) 'Fill the DataSet with the rows returned.

        'Get the number of rows returned, and then assign it to the variable
        Dim rowCount As String
        rowCount = MyDataAdapter.SelectCommand.Parameters(1).Value.ToString &amp; &quot; Rows Found!&quot;

        MyDataAdapter.Dispose() 'Dispose of the DataAdapter.
        MyConnection.Close() 'Close the connection.

        Return DS

    End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/06/10/connecting-asp-net-to-sql-server-2005-stored-procedures-into-dataset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending Email by your own Gmail account + Attachment using ASP.NET 2.0 and VB.NET</title>
		<link>http://redsouljaz.com/2009/06/06/sending-email-by-your-own-gmail-account-attachment-using-asp-net-2-0-and-vb-net/</link>
		<comments>http://redsouljaz.com/2009/06/06/sending-email-by-your-own-gmail-account-attachment-using-asp-net-2-0-and-vb-net/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 18:28:12 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[sending email]]></category>
		<category><![CDATA[sending email by gmail account using asp.net]]></category>
		<category><![CDATA[sending email using asp.net]]></category>
		<category><![CDATA[sending email with attachment]]></category>
		<category><![CDATA[sending email with attachment by gmail account]]></category>
		<category><![CDATA[sending email with attachment using asp.net]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=152</guid>
		<description><![CDATA[First of all, you need need to set something in your gmail account to enable sending email using asp.net
1. Open you gmail account and go to setting
2. Click on Forwarding and POP/IMAP
3. Choose Enable POP for mail that arrives from now on
4. Click save changes

Here is the code for sending email from asp.net by using gmail account]]></description>
			<content:encoded><![CDATA[<p>First of all, you need need to set something in your gmail account to enable sending email using asp.net<br />
1. Open you gmail account and go to setting<br />
2. Click on Forwarding and POP/IMAP<br />
3. Choose Enable POP for mail that arrives from now on<br />
4. Click save changes</p>
<p>Here is the code for sending email from asp.net by using gmail account<br />
<span id="more-152"></span><br />
create class sendmail.vb</p>
<pre class="brush: css;">

Imports Microsoft.VisualBasic
Imports System
Imports System.Web.Mail

Public Class sendEmail

    Public Shared Function SendEmail(ByVal pGmailEmail As String, ByVal pGmailPassword As String, ByVal pTo As String, ByVal pSubject As String, ByVal pBody As String, ByVal pFormat As System.Web.Mail.MailFormat, _
     ByVal pAttachmentPath As String) As Boolean
        Try
            Dim myMail As New System.Web.Mail.MailMessage()
            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;, &quot;smtp.gmail.com&quot;)
            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;, &quot;465&quot;)
            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;, &quot;2&quot;)

            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/smtpauthenticate&quot;, &quot;1&quot;)
            'Use 0 for anonymous
            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/sendusername&quot;, pGmailEmail)
            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/sendpassword&quot;, pGmailPassword)
            myMail.Fields.Add(&quot;http://schemas.microsoft.com/cdo/configuration/smtpusessl&quot;, &quot;true&quot;)
            myMail.From = pGmailEmail
            myMail.[To] = pTo
            myMail.Subject = pSubject
            myMail.BodyFormat = pFormat
            myMail.Body = pBody

            If pAttachmentPath.Trim() &lt;&gt; &quot;&quot; Then
                Dim MyAttachment As New MailAttachment(pAttachmentPath)
                myMail.Attachments.Add(MyAttachment)
                myMail.Priority = System.Web.Mail.MailPriority.High
            End If

            System.Web.Mail.SmtpMail.SmtpServer = &quot;smtp.gmail.com:465&quot;
            System.Web.Mail.SmtpMail.Send(myMail)

            Return True
        Catch ex As Exception
            Throw
        End Try
    End Function

End Class
</pre>
<p>And this is the code to use the function</p>
<pre class="brush: css;">
SendEmail(&quot;youraccount@gmail.com&quot;, &quot;yourownGmailPassword&quot;, &quot;yourfriend@yahoo.com&quot;, &quot;HAHAHAHA&quot;, &quot;AAAA&quot;, MailFormat.Text, Server.MapPath(&quot;Reports/Invoice.pdf&quot;))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/06/06/sending-email-by-your-own-gmail-account-attachment-using-asp-net-2-0-and-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read Excel Cell Value from ASP.NET 2008 &#8211; VB.NET</title>
		<link>http://redsouljaz.com/2009/06/04/read-excel-cell-value-from-asp-net-2008-vb-net/</link>
		<comments>http://redsouljaz.com/2009/06/04/read-excel-cell-value-from-asp-net-2008-vb-net/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 01:07:00 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[asp.net read excel value]]></category>
		<category><![CDATA[how to read an excel cel value]]></category>
		<category><![CDATA[import excel from asp.net]]></category>
		<category><![CDATA[Read Excel cell value]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=140</guid>
		<description><![CDATA[In this article I will show how to read value from excel per cell,]]></description>
			<content:encoded><![CDATA[<p>In this article I will show how to read value from excel per cell,</p>
<p>First Im using FileUpload component from asp.net</p>
<pre class="brush: css;">
	&lt;td&gt;
                &lt;asp:FileUpload ID=&quot;uplFile&quot; runat=&quot;server&quot;  Width=&quot;367px&quot;/&gt;
	&lt;/td&gt;
</pre>
<p><span id="more-140"></span><br />
Don&#8217;t Forget to add triger to set autopostback, or else some people may counter error when the want to get the file name after they click browse button. Normally you put this code at the buttom</p>
<pre class="brush: css;">
      	&lt;triggers&gt;
              &lt;asp:PostBackTrigger ControlID=&quot;btnUpload&quot; /&gt;
        &lt;/triggers&gt;
</pre>
<p>At behind code import<br />
Imports Excel = Microsoft.Office.Interop</p>
<p>In event click</p>
<pre class="brush: css;">
        Dim oApp As New Excel.Excel.Application()
        Dim oWBa As Excel.Excel.Workbook
        Dim oWS As Excel.Excel.Worksheet

            If uplFile.PostedFile.FileName &lt;&gt; &quot;&quot; Then
                filename = Mid(uplFile.PostedFile.FileName, InStrRev(uplFile.PostedFile.FileName, &quot;\&quot;) + 1, Len(uplFile.PostedFile.FileName) - InStrRev(uplFile.PostedFile.FileName, &quot;\&quot;))
                uplFile.PostedFile.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory &amp; filename)

                oWBa = oApp.Workbooks.Open(System.AppDomain.CurrentDomain.BaseDirectory &amp; filename)
                oWS = DirectCast(oWBa.Worksheets(1), Excel.Excel.Worksheet)
                oApp.Visible = False

                    Dim strkey2(3) As String
                    strkey2(0) = CStr(oWS.Range(&quot;A1&quot;)
                    strkey2(1) = CStr(oWS.Range(&quot;B1&quot;)
                    strkey2(2) = CStr(oWS.Range(&quot;C1&quot;)
                    strkey2(3) = CStr(oWS.Range(&quot;D1&quot;)

                   oWS = Nothing
                   oWBa.Close()
                   oWBa = Nothing
                   oApp.Quit()
                   oApp = Nothing

     End If
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/06/04/read-excel-cell-value-from-asp-net-2008-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Management Objects with VB.net</title>
		<link>http://redsouljaz.com/2009/05/23/sql-server-management-objects-with-vb-net/</link>
		<comments>http://redsouljaz.com/2009/05/23/sql-server-management-objects-with-vb-net/#comments</comments>
		<pubDate>Sat, 23 May 2009 14:40:12 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[sql server 2005]]></category>
		<category><![CDATA[SQL Server Management Objects]]></category>
		<category><![CDATA[SQL SMO]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=121</guid>
		<description><![CDATA[SQL Server™ Management Objects (SMO) offer developers a robust toolset for operations such as backing up and restoring databases, and issuing Data Definition Language (DDL) commands. Using SQL SMO you can also connect to SQL Server, iterate through a collection of database objects and perform a variety of tasks against them.
]]></description>
			<content:encoded><![CDATA[<p>SQL Server™ Management Objects (SMO) offer developers a robust toolset for operations such as backing up and restoring databases, and issuing Data Definition Language (DDL) commands. Using SQL SMO you can also connect to SQL Server, iterate through a collection of database objects and perform a variety of tasks against them.</p>
<p>I have been created simple program using vb.net 2008 and sql server 2005 using SQL SMO.<br />
<span id="more-121"></span><br />
The purpose of this program is to show the list of database available and show the data based on sql queries to datagrid. All the connection is using SQL SMO.</p>
<p>#1 step:</p>
<p>Add Reference Microsoft.SqlServer.SMO and Microsoft.SqlServer.ConnectionInfo</p>
<p>#2 step:</p>
<pre class="brush: css;">
Create class SMOHelper:

Imports Microsoft.SqlServer.Management.Smo
Public Class SMOHelper
#Region &quot;Fields&quot;
&lt;p style=&quot;padding-left:30px;&quot;&gt;Private _serverName As String
Private _instance As String
Private _version As String
Private _isLocal As Boolean
Private _server As Server
Private _userName As String
Private _password As String
Private _useWindowsAuthentication As Boolean = True

#End Region
#Region &quot;Properties&quot;
&lt;p style=&quot;padding-left:30px;&quot;&gt;Public Property ServerName() As String
Get
Return _serverName
End Get
Set(ByVal value As String)
_serverName = value
End Set
End Property
Public Property Instance() As String
Get
Return _instance
End Get
Set(ByVal value As String)
_instance = value
End Set
End Property
Public Property version() As String
Get
Return _version
End Get
Set(ByVal value As String)
_version = value
End Set
End Property
Public Property isLocal() As Boolean
Get
Return _isLocal
End Get
Set(ByVal value As Boolean)
_isLocal = value
End Set
End Property
Public ReadOnly Property server() As Server
Get
Return _server
End Get
End Property
Public Property userName() As String
Get
Return _userName
End Get
Set(ByVal value As String)
_userName = value
End Set
End Property
Public Property password() As String
Get
Return _password
End Get
Set(ByVal value As String)
_password = value
End Set
End Property
Public Property useWindowsAuthentication() As Boolean
Get
Return _useWindowsAuthentication
End Get
Set(ByVal value As Boolean)
_useWindowsAuthentication = value
End Set
End Property

#End Region
#Region &quot;Constructors&quot;
&lt;p style=&quot;padding-left:30px;&quot;&gt;Public Sub New()
_server = New Server
End Sub
Public Sub New(ByVal serverAndInstanceName1 As String, ByVal username1 As String, ByVal password1 As String, ByVal useWindowsAuthentication1 As Boolean)
_server = New Server
ServerName = serverAndInstanceName1
userName = username1
password = password1
End Sub

#End Region
#Region &quot;Methods&quot;
&lt;p style=&quot;padding-left:30px;&quot;&gt;Public Function GetDatabaseNameList() As List(Of String)
Dim dbList As New List(Of String)()
For Each db As Database In server.Databases
dbList.Add(db.Name)
Next
Return dbList
End Function
Public Sub Connect()
server.ConnectionContext.ServerInstance = ServerName
If useWindowsAuthentication = True Then
server.ConnectionContext.LoginSecure = useWindowsAuthentication
Else
server.ConnectionContext.LoginSecure = useWindowsAuthentication
server.ConnectionContext.Login = userName
server.ConnectionContext.Password = password
End If
Try
server.ConnectionContext.Connect()
Catch ex As Exception
MsgBox(&quot;ERROR&quot; &amp;amp; ex.Message.ToString)
End Try
End Sub

#End Region
End Class

&lt;img class=&quot;aligncenter size-full wp-image-124&quot; title=&quot;PRINT&quot; src=&quot;http://redsouljaz.files.wordpress.com/2009/05/print.jpg&quot; alt=&quot;PRINT&quot; width=&quot;457&quot; height=&quot;576&quot; /&gt;
</pre>
<p>#3 Step: Add this code to the form code</p>
<pre class="brush: css;">
Imports Microsoft.SqlServer.Management.Smo

Public Class Form1
Dim smoHelper As New SMOHelper

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dtServers As DataTable = SmoApplication.EnumAvailableSqlServers(False)
Dim sqlServerName As String
For Each row As DataRow In dtServers.Rows

sqlServerName = row(&quot;Server&quot;).ToString
If Not row(&quot;Instance&quot;) Is Nothing And row(&quot;Instance&quot;).ToString.Length &amp;gt; 0 Then
sqlServerName += &quot;\&quot; + row(&quot;Instance&quot;).ToString
End If
Next
txtServerName.Text = sqlServerName.ToString

End Sub

Private Sub chkUseWindowsAuthentication_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkUseWindowsAuthentication.CheckedChanged
If chkUseWindowsAuthentication.Checked = True Then
txtPassword.Enabled = False
txtUserName.Enabled = False
Else
txtPassword.Enabled = True
txtUserName.Enabled = True
End If

End Sub

Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
If txtServerName.Text &amp;lt;&amp;gt; &quot;&quot; And (chkUseWindowsAuthentication.Checked = True Or (txtPassword.Text &amp;lt;&amp;gt; &quot;&quot; And txtUserName.Text &amp;lt;&amp;gt; &quot;&quot;)) Then

grpConnect.Enabled = False
SMOHelper = New SMOHelper(txtServerName.Text, txtUserName.Text, txtPassword.Text, chkUseWindowsAuthentication.Checked)
smoHelper.Connect()
If Not smoHelper.server Is Nothing Then
cboDatabase.DataSource = smoHelper.GetDatabaseNameList()
cboDatabase.Focus()

End If

End If

End Sub

Private Sub btnExecute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExecute.Click
If txtSQL.Text &amp;lt;&amp;gt; &quot;&quot; Then
Dim db As Database = smoHelper.server.Databases(cboDatabase.SelectedValue.ToString)
If Not db Is Nothing Then
Dim sql As String
sql = txtSQL.Text
Try
If sql.Replace(&quot; &quot;, &quot;&quot;).ToUpper.StartsWith(&quot;SELECT&quot;) Then
Dim ds As DataSet = db.ExecuteWithResults(txtSQL.Text)

dgvResults.DataSource = ds.Tables(0)

End If
Catch ex As Exception

End Try
End If
End If
End Sub
End Class
</pre>
<p>You can read more at http://msdn.microsoft.com/en-us/magazine/cc163409.aspx</p>
<p>In that site, you can download example of program in c#</p>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/05/23/sql-server-management-objects-with-vb-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

