<?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>Code Slabs</title>
	<atom:link href="http://codeslabs.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeslabs.wordpress.com</link>
	<description>An online warehouse for "slabs" of code found to be useful in day-to-day operations.</description>
	<lastBuildDate>Thu, 30 Jun 2011 12:24:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codeslabs.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/1fd27aa1db221ff1cb6e3ed2a98494f6?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Code Slabs</title>
		<link>http://codeslabs.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codeslabs.wordpress.com/osd.xml" title="Code Slabs" />
	<atom:link rel='hub' href='http://codeslabs.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Auto Generating a Data Dictionary &#8211; Part 2</title>
		<link>http://codeslabs.wordpress.com/2008/12/02/auto-generating-a-data-dictionary-part-2/</link>
		<comments>http://codeslabs.wordpress.com/2008/12/02/auto-generating-a-data-dictionary-part-2/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 22:31:42 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=184</guid>
		<description><![CDATA[This slab takes the data gathered in Part 1 and turns it into an Excel workbook. Very useful for most needs! 1. Start a new Winforms project. 2. Make it look like this: 3. Add these references: Microsoft.SqlServer.Smo Microsoft.SqlServer.Management.Sdk.Sfc Microsoft.SqlServer.ConnectionInfo Microsoft.Office.Interop.Excel and of course, DataLayer 4. Paste this code into Form1&#8242;s code behind:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=184&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This slab takes the data gathered in <a href="http://codeslabs.wordpress.com/2008/11/20/auto-generating-a-data-dictionary/">Part 1</a> and turns it into an Excel workbook. Very useful for most needs!<span id="more-184"></span></p>
<p>1. Start a new Winforms project.<br />
2. Make it look like this:</p>
<div id="attachment_185" class="wp-caption alignnone" style="width: 520px"><a href="http://codeslabs.files.wordpress.com/2008/12/datadictionaryscreencap.png"><img class="size-full wp-image-185" title="datadictionaryscreencap" src="http://codeslabs.files.wordpress.com/2008/12/datadictionaryscreencap.png?w=510&#038;h=398" alt="The Data Dictionary Generator UI" width="510" height="398" /></a><p class="wp-caption-text">The Data Dictionary Generator UI</p></div>
<p>3. Add these references:</p>
<ul>
<li>Microsoft.SqlServer.Smo</li>
<li>Microsoft.SqlServer.Management.Sdk.Sfc</li>
<li>Microsoft.SqlServer.ConnectionInfo</li>
<li>Microsoft.Office.Interop.Excel</li>
<li>and of course, <a href="http://codeslabs.wordpress.com/2008/10/02/the-data-access-layer-object/" target="_blank">DataLayer</a></li>
</ul>
<p>4. Paste this code into Form1&#8242;s code behind:</p>
<p><pre class="brush: vb;">Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
Imports Microsoft.Office.Interop
Imports System.Data
Imports DataLayer

Public Class Form1
    Private DataSource As String = &quot;Data Source=&quot;
    Private InitialCatalog As String = &quot;;Initial Catalog=&quot;
    Private IntegratedSecurity As String = &quot;;Integrated Security=True&quot;

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Show()
        Me.Cursor = Cursors.WaitCursor
        Dim servers As DataTable
        servers = SmoApplication.EnumAvailableSqlServers(False)
        For Each drServer As DataRow In servers.Rows
            ComboBox1.Items.Add(drServer(&quot;Name&quot;))
        Next
        ComboBox1.Text = &quot;&lt;Select a server...&gt;&quot;
        TextBox1.Text = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        TextBox2.Text = DataSource &amp; InitialCatalog &amp; IntegratedSecurity
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub ComboBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles ComboBox1.Leave, _
            ComboBox1.SelectedIndexChanged

        GetDatabases()
    End Sub

    Private Sub ComboBox2_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles ComboBox2.Leave, _
            ComboBox2.SelectedIndexChanged

        TextBox2.Text = DataSource &amp; ComboBox1.Text &amp; InitialCatalog &amp; ComboBox2.Text &amp; IntegratedSecurity

        TextBox1.Text = My.Computer.FileSystem.SpecialDirectories.MyDocuments _
            &amp; &quot;\&quot; &amp; ComboBox1.Text &amp; &quot;-&quot; &amp; ComboBox2.Text &amp; &quot;-DataDictionary.xls&quot;
    End Sub

    Private Sub GetDatabases()
        If ComboBox1.Text &lt;&gt; &quot;&quot; And ComboBox1.Text &lt;&gt; &quot;&lt;Select a server...&gt;&quot; Then
            Dim theServerInfo As New Server(New ServerConnection(ComboBox1.Text))
            For Each currentDatabase As Database In theServerInfo.Databases
                Me.ComboBox2.Items.Add(currentDatabase.Name)
            Next
        End If

        TextBox2.Text = DataSource &amp; ComboBox1.Text &amp; InitialCatalog &amp; IntegratedSecurity
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.FileName = ComboBox1.Text &amp; &quot;-&quot; &amp; ComboBox2.Text &amp; &quot;-DataDictionary.xls&quot;
        SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = &quot;Excel Workbooks (*.xls)|*.xls|All Files (*.*)|*.*&quot;

        If (SaveFileDialog.ShowDialog(Me) &lt;&gt; System.Windows.Forms.DialogResult.OK) Then
            'user canceled out
            Exit Sub
        End If

        TextBox1.Text = SaveFileDialog.FileName
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim iRowCount As Integer, iColCount As Integer
        Dim oExcel As Object
        Dim oBook As Object
        Dim oSheet1 As Object, oSheet2 As Object, oSheet3 As Object
        oExcel = CreateObject(&quot;Excel.Application&quot;)
        oBook = oExcel.Workbooks.Add
        Dim MyDAL As New DAL(TextBox2.Text)
        Dim Datasets As Generic.SortedList(Of Integer, DataTable) = MyDAL.GetMultipleDataTables(&quot;EXEC dbo.GenerateDataDictionary&quot;)
        If Datasets Is Nothing Then
            MsgBox(&quot;Unable to gather results.  Is the stored procedure installed?&quot;, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, &quot;Error&quot;)
            Exit Sub
        End If

        oSheet1 = oBook.Worksheets(1)
        With oSheet1
            .Name = &quot;Tables&quot;
            .Range(&quot;A1&quot;).Value = &quot;Table Name&quot;
            .Range(&quot;B1&quot;).Value = &quot;Description&quot;
            .Range(&quot;A1:B1&quot;).Font.Bold = True
            iRowCount = Datasets(0).Rows.Count
            iColCount = Datasets(0).Columns.Count
            .Range(&quot;A2&quot;).Resize(iRowCount, iColCount).Value = GetDataAsObject(iRowCount, iColCount, Datasets(0))
            .Range(&quot;A1:B&quot; &amp; iRowCount.ToString).EntireColumn.Columns.AutoFit()
            .Range(&quot;A2&quot;).Select()
            .Application.ActiveWindow.FreezePanes = True
        End With

        oSheet2 = oBook.Worksheets(2)
        With oSheet2
            .Name = &quot;Columns&quot;
            .Range(&quot;A1&quot;).Value = &quot;Column&quot;
            .Range(&quot;B1&quot;).Value = &quot;Table&quot;
            .Range(&quot;C1&quot;).Value = &quot;Data Type&quot;
            .Range(&quot;D1&quot;).Value = &quot;Default Value&quot;
            .Range(&quot;E1&quot;).Value = &quot;Nullable&quot;
            .Range(&quot;F1&quot;).Value = &quot;Description&quot;
            .Range(&quot;A1:F1&quot;).Font.Bold = True
            iRowCount = Datasets(1).Rows.Count
            iColCount = Datasets(1).Columns.Count
            .Range(&quot;A2&quot;).Resize(iRowCount, iColCount).Value = GetDataAsObject(iRowCount, iColCount, Datasets(1))
            .Range(&quot;A1:F&quot; &amp; iRowCount.ToString).EntireColumn.Columns.AutoFit()
            .Activate()
            .Range(&quot;A2&quot;).Select()
            .Application.ActiveWindow.FreezePanes = True
        End With

        oSheet3 = oBook.Worksheets(3)
        With oSheet3
            .Name = &quot;Relationships&quot;
            .Range(&quot;A1&quot;).Value = &quot;Constraint&quot;
            .Range(&quot;B1&quot;).Value = &quot;Type&quot;
            .Range(&quot;C1&quot;).Value = &quot;Table&quot;
            .Range(&quot;D1&quot;).Value = &quot;Column&quot;
            .Range(&quot;E1&quot;).Value = &quot;Constrained By&quot;
            .Range(&quot;F1&quot;).Value = &quot;Description&quot;
            .Range(&quot;G1&quot;).Value = &quot;Delete Action&quot;
            .Range(&quot;H1&quot;).Value = &quot;Update Action&quot;
            .Range(&quot;A1:H1&quot;).Font.Bold = True
            iRowCount = Datasets(2).Rows.Count
            iColCount = Datasets(2).Columns.Count
            .Range(&quot;A2&quot;).Resize(iRowCount, iColCount).Value = GetDataAsObject(iRowCount, iColCount, Datasets(2))
            .Range(&quot;A1:H&quot; &amp; iRowCount.ToString).EntireColumn.Columns.AutoFit()
            .Activate()
            .Range(&quot;A2&quot;).Select()
            .Application.ActiveWindow.FreezePanes = True
        End With

        oSheet1.Activate()

        Try
            oBook.SaveAs(TextBox1.Text)
        Catch ex As Exception
            If MsgBox(&quot;There was a problem saving the file.&quot; &amp; Environment.NewLine _
                      &amp; &quot;Do you want to see the error trace?&quot;, _
                      MsgBoxStyle.Question + MsgBoxStyle.YesNo, &quot;Error&quot;) = MsgBoxResult.Yes Then

                MsgBox(ex.ToString, MsgBoxStyle.Information + MsgBoxStyle.OkOnly, &quot;Error&quot;)
            End If
        End Try

        'kill the objects
        oSheet1 = Nothing
        oSheet2 = Nothing
        oSheet3 = Nothing
        oBook = Nothing
        oExcel.Quit()
        oExcel = Nothing
        GC.Collect()

        MsgBox(&quot;Data Dictionary created.&quot;, MsgBoxStyle.Information + MsgBoxStyle.OkOnly, &quot;Notice&quot;)
    End Sub

    Private Shared Function GetDataAsObject(ByVal iRowCount As Integer, ByVal iColCount As Integer, ByVal dt As DataTable) As Object(,)
        Dim oData(iRowCount, iColCount) As Object, iRow As Integer, iCol As Integer

        For iRow = 0 To iRowCount - 1
            For iCol = 0 To iColCount - 1
                oData(iRow, iCol) = dt.Rows(iRow).Item(iCol)
            Next
        Next
        Return oData
    End Function

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
    End Sub
End Class
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/184/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=184&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/12/02/auto-generating-a-data-dictionary-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>

		<media:content url="http://codeslabs.files.wordpress.com/2008/12/datadictionaryscreencap.png" medium="image">
			<media:title type="html">datadictionaryscreencap</media:title>
		</media:content>
	</item>
		<item>
		<title>Auto Generating a Data Dictionary &#8211; Part 1</title>
		<link>http://codeslabs.wordpress.com/2008/11/20/auto-generating-a-data-dictionary/</link>
		<comments>http://codeslabs.wordpress.com/2008/11/20/auto-generating-a-data-dictionary/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 19:57:03 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=172</guid>
		<description><![CDATA[Wouldn&#8217;t it be great to be able to generate a data dictionary for a SQL 2008 Database? You can, with this handy slab. Running this code up against a DB will give you lots of information, unless you don&#8217;t set it in the first place. At the very least, you should be creating keys and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=172&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Wouldn&#8217;t it be great to be able to generate a data dictionary for a SQL 2008 Database? You can, with this handy slab.<span id="more-172"></span></p>
<p>Running this code up against a DB will give you lots of information, unless you don&#8217;t set it in the first place. At the very least, you should be creating keys and relationships. If you&#8217;re into &#8220;Agile&#8221;, this idea will probably cause you to foam at the mouth, but I&#8217;m okay with that <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>All of this assumes &#8211; with its inherent dangers &#8211; that you have SSMS open, and you are in the database for which you want to create the dictionary. Here&#8217;s some preliminary pointers:</p>
<ul>
<li><strong>To set a table&#8217;s description</strong>: right click the table, select Properties. Switch to the Extended Properties page and create a Property named &#8220;MS_Description&#8221;. The value to what you want to describe the table.</li>
<li><strong>To set a column&#8217;s description</strong>: Open the table in the Design view and select the column. Enter the description in the Column Properties pane under Description.</li>
<li><strong>To set a Primary Key&#8217;s description</strong>: With the table&#8217;s design view open, open the Index\Keys dialog. Set the comments in the Description field under Identity.</li>
<li><strong>To set a Foreign Key&#8217;s description</strong>: With the table&#8217;s design view open, open the Relationships dialog. Set the comments in the Description field under Identity.</li>
</ul>
<p>Note: <em>Tested on SQL Server 2008</em>. If you find something that doesn&#8217;t work on an older version, shoot me updated code. Otherwise, I&#8217;ll eventually add the code when I get around to trying to document one of the older systems.</p>
<p>Run this first to set up the infrastructure:<br />
<pre class="brush: sql;">CREATE TABLE [dbo].[DataDictionaryExclusions](
	[ExclusionID] [int] IDENTITY(1,1) NOT NULL,
	[ObjectName] [varchar](100) NOT NULL,
	[ObjectType] [varchar](25) NOT NULL,
 CONSTRAINT [PK_DataDictionaryExclusions] PRIMARY KEY CLUSTERED 
(
	[ExclusionID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]

INSERT INTO DataDictionaryExclusions (ObjectName, ObjectType)
VALUES	('DataDictionaryExclusions', 'Table'),
		('GenerateDataDictionary', 'Procedure')</pre></p>
<p>Then Add this stored procedure:<br />
<pre class="brush: sql;">CREATE PROCEDURE [dbo].[GenerateDataDictionary]
-- =============================================
-- Author:		Corey Furman
-- Create date: 20 Nov 2008
-- Description:	Generates a data dictionary
-- =============================================
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	/* variable set up */
	DECLARE @LineFeed	AS VARCHAR(2)
	DECLARE @Tab		AS CHAR
	DECLARE @SpaceChar	AS CHAR
	DECLARE @WhiteSpace AS VARCHAR(4)
	SET @LineFeed		= CHAR(10) + CHAR(13)
	SET @Tab			= CHAR(9)
	SET @SpaceChar		= CHAR(32)
	SET @WhiteSpace		= @LineFeed + @Tab + @SpaceChar
	DECLARE @Period		AS CHAR
	SET @Period			= '.'
	

	/* table listing */
	SELECT	[TableName]		= T.Name,
			[Description]	= COALESCE(E.value, ''),
			[Type]			= 'Table'
	FROM sys.tables T
	LEFT JOIN sys.extended_properties E ON E.major_id = T.object_id
		AND E.minor_id = 0
	WHERE T.name NOT IN (SELECT ObjectName FROM dbo.DataDictionaryExclusions WHERE ObjectType = 'Table')
	
	UNION
	
	SELECT	[TableName]		= V.Name,
			[Description]	= COALESCE(E.value, ''),
			[Type]			= 'View'
	FROM sys.views V
	LEFT JOIN sys.extended_properties E ON E.major_id = V.object_id
		AND E.minor_id = 0
	WHERE V.name NOT IN (SELECT ObjectName FROM dbo.DataDictionaryExclusions WHERE ObjectType = 'View')
	ORDER BY T.Name

	/* column listing */
	SELECT	DISTINCT
			[Column]		= C.COLUMN_NAME,
			[Table]			= C.TABLE_NAME,
			[Position]		= C.ORDINAL_POSITION,
			DataType		= CASE	WHEN C.DATA_TYPE = 'varchar' THEN C.DATA_TYPE + '(' + CAST(C.CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'nvarchar' THEN C.DATA_TYPE + '(' + CAST(C.CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'text' THEN C.DATA_TYPE + '(' + CAST(C.CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'ntext' THEN C.DATA_TYPE + '(' + CAST(C.CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'char' THEN C.DATA_TYPE + '(' + CAST(C.CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'numeric' THEN C.DATA_TYPE + '(' + CAST(C.NUMERIC_PRECISION AS VARCHAR(10)) + ', ' + CAST(C.NUMERIC_SCALE AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'decimal' THEN C.DATA_TYPE + '(' + CAST(C.NUMERIC_PRECISION AS VARCHAR(10)) + ', ' + CAST(C.NUMERIC_SCALE AS VARCHAR(10)) + ')'
									WHEN C.DATA_TYPE = 'float' THEN C.DATA_TYPE + '(' + CAST(C.NUMERIC_PRECISION AS VARCHAR(10)) + ', ' + CAST(C.NUMERIC_SCALE AS VARCHAR(10)) + ')'
							  ELSE C.DATA_TYPE
							  END,
			DefaultValue	= ISNULL(C.COLUMN_DEFAULT, ''),
			Nullable		= C.IS_NULLABLE,
			[Description]	= ISNULL(E.value, '')
	FROM information_schema.columns C
	LEFT JOIN sys.syscolumns C2 ON C2.name = C.COLUMN_NAME
	LEFT JOIN sys.extended_properties E ON E.major_id = C2.id
		AND E.minor_id = C2.colid
	WHERE C.TABLE_NAME NOT IN (SELECT ObjectName FROM dbo.DataDictionaryExclusions WHERE ObjectType IN ('Table', 'View'))
	ORDER BY C.COLUMN_NAME, C.TABLE_NAME

	/* relationships */
	SELECT	[Constraint]		= T.CONSTRAINT_NAME,
			[Type]				= LOWER(REPLACE(T.CONSTRAINT_TYPE, ' KEY', '')),
			[Table]				= T.TABLE_NAME,
			[Column]			= C1.COLUMN_NAME,
			ConstrainedBy		= CASE WHEN LOWER(REPLACE(T.CONSTRAINT_TYPE, ' KEY', '')) = 'foreign' THEN C2.TABLE_NAME + '.' + C2.COLUMN_NAME
								  ELSE ''
								  END,
			[Description]		= CASE WHEN LOWER(REPLACE(T.CONSTRAINT_TYPE, ' KEY', '')) = 'primary' THEN ISNULL(E1.value, '')
								  ELSE ISNULL(E2.value, '')
								  END,
			[DeleteAction]		= LOWER(REPLACE(ISNULL(F.delete_referential_action_desc, ''), '_', ' ')),
			[UpdateAction]		= LOWER(REPLACE(ISNULL(F.update_referential_action_desc, ''), '_', ' '))
	FROM information_schema.TABLE_CONSTRAINTS T
	JOIN information_schema.CONSTRAINT_COLUMN_USAGE C1 ON C1.CONSTRAINT_NAME = T.CONSTRAINT_NAME
	LEFT JOIN information_schema.REFERENTIAL_CONSTRAINTS R ON R.CONSTRAINT_NAME = T.CONSTRAINT_NAME
	LEFT JOIN information_schema.CONSTRAINT_COLUMN_USAGE C2 ON C2.CONSTRAINT_NAME = R.UNIQUE_CONSTRAINT_NAME
	LEFT JOIN sys.key_constraints K ON K.name = T.CONSTRAINT_NAME
	LEFT JOIN sys.extended_properties E1 ON E1.major_id = K.object_id
	LEFT JOIN sys.foreign_keys F ON F.name = T.CONSTRAINT_NAME
	LEFT JOIN sys.extended_properties E2 ON E2.major_id = F.object_id
	WHERE T.TABLE_NAME NOT IN (SELECT ObjectName FROM dbo.DataDictionaryExclusions WHERE ObjectType = 'Table')
	ORDER BY T.TABLE_NAME, T.CONSTRAINT_TYPE DESC

	/* stored procedures */
	SELECT name
	FROM sys.procedures
	ORDER BY name

	/* procedures to object cross reference */
	SELECT * FROM (
		SELECT DISTINCT
			[SProc Name]	= P.name,
			[Object Name]	= O.name,
			[Obj Type]		= CASE	WHEN O.xtype = 'u' THEN 'Table'
									WHEN O.xtype = 'v' THEN 'View'
									WHEN O.xtype = 'p' THEN 'Procedure'
							  END
		FROM sysobjects O
		INNER JOIN (
			SELECT A.name, B.text
			FROM sysobjects A INNER JOIN syscomments B ON A.id = B.id
		) P ON P.text LIKE '%[' + @WhiteSpace + @Period + ']' + O.name + '[' + @WhiteSpace + ']%'
			AND O.xtype IN ('u', 'v', 'p')
			AND P.name &lt;&gt; O.name
	) data
	WHERE [SProc Name] NOT IN (SELECT ObjectName FROM dbo.DataDictionaryExclusions WHERE ObjectType = 'Procedure')
	ORDER BY [SProc Name], [Obj Type], [Object Name]

END</pre></p>
<p>You run it like this:</p>
<pre>EXEC dbo.GenerateDataDictionary</pre>
<p><a href="http://codeslabs.wordpress.com/2008/12/02/auto-generating-a-data-dictionary-part-2/">Part 2</a> will be an app that will dump this data to an Excel workbook&#8230; believe me, you won&#8217;t want to miss it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=172&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/11/20/auto-generating-a-data-dictionary/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>TSQL Function that Tables a Delimited String</title>
		<link>http://codeslabs.wordpress.com/2008/11/20/tsql-function-that-tables-a-delimited-string/</link>
		<comments>http://codeslabs.wordpress.com/2008/11/20/tsql-function-that-tables-a-delimited-string/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 18:09:22 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=166</guid>
		<description><![CDATA[Use today&#8217;s slab to turn a delimited string into table variable. You can call this function like this:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=166&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Use today&#8217;s slab to turn a delimited string into table variable.<span id="more-166"></span></p>
<p><pre class="brush: sql;">
CREATE FUNCTION [dbo].[udf_Split](@text VARCHAR(8000), @delimiter CHAR(1) = ' ')
-- =============================================
-- Author:      Corey Furman
-- Create date: 1 Nov 2008
-- Description: Takes in a delimited string and returns a table
-- =============================================
RETURNS @TableVar TABLE
(    
    Ordinal INT IDENTITY PRIMARY KEY,
    Value   VARCHAR(8000)
)
AS
BEGIN
    DECLARE @index INT
    SET @index = -1

    WHILE (LEN(@text) &gt; 0)
    BEGIN
        SET @index = CHARINDEX(@delimiter , @text)
        IF (@index = 0) AND (LEN(@text) &gt; 0)
        BEGIN
            INSERT INTO @TableVar VALUES (LTRIM(RTRIM(@text)))
            BREAK
        END

        IF (@index &gt; 1)
        BEGIN
            INSERT INTO @TableVar VALUES (LTRIM(RTRIM(LEFT(@text, @index - 1))))
            SET @text = RIGHT(@text, (LEN(@text) - @index))
        END
        ELSE
            SET @text = RIGHT(@text, (LEN(@text) - @index))
    END

    RETURN
END
</pre></p>
<p>You can call this function like this:<br />
<pre class="brush: sql;">
-- to specify what to use as a delimiter
SELECT * FROM dbo.udf_Split('dog, cat, hamster', ',')

-- to take advantage of the default value of the delimiter parameter, specify the DEFAULT keyword
SELECT * FROM dbo.udf_Split('pig horse chicken', DEFAULT)
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/166/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=166&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/11/20/tsql-function-that-tables-a-delimited-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>Notify Icon Template</title>
		<link>http://codeslabs.wordpress.com/2008/11/13/notify-icon-template/</link>
		<comments>http://codeslabs.wordpress.com/2008/11/13/notify-icon-template/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 18:17:00 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[GUI Design]]></category>
		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=164</guid>
		<description><![CDATA[Here&#8217;s a quick slab to bootstrap you into using system tray icons&#8230; Start a windows for project, and add a NotifyIcon object to the component panel in the designer.  Place this code behind the form:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=164&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick slab to bootstrap you into using system tray icons&#8230;<span id="more-164"></span></p>
<p>Start a windows for project, and add a NotifyIcon object to the component panel in the designer.  Place this code behind the form:</p>
<p><pre class="brush: vb;">
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        NotifyIcon1.Icon = Me.Icon
        NotifyIcon1.Visible = False
    End Sub

    Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
        ReviveTheForm()
    End Sub

    Private Sub ReviveTheForm()
        Me.Visible = True
        Me.WindowState = FormWindowState.Normal
        NotifyIcon1.Visible = False
    End Sub

    Private Sub MinimizeToTray()
        Me.Visible = False
        NotifyIcon1.Visible = True
    End Sub

    Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
        If Me.WindowState = FormWindowState.Minimized Then
            MinimizeToTray()
        End If
    End Sub
End Class
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=164&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/11/13/notify-icon-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>HTML Application</title>
		<link>http://codeslabs.wordpress.com/2008/11/12/html-application/</link>
		<comments>http://codeslabs.wordpress.com/2008/11/12/html-application/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 21:13:17 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[HTA]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=152</guid>
		<description><![CDATA[Windows PE doesn&#8217;t include the .Net framework &#8211; so that neat app your just wrote can be flushed.  Or is it a waste?  What if we converted it to an HTA?  Here&#8217;s a slab that takes input from a GUI and sets up scripts to load servers. &#60;HTA:APPLICATION     id="oDPBS"     applicationname="DiskPartBootStrapper"     border="thin"     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=152&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Windows PE doesn&#8217;t include the .Net framework &#8211; so that neat app your just wrote can be flushed.  Or is it a waste?  What if we converted it to an HTA?  Here&#8217;s a slab that takes input from a GUI and sets up scripts to load servers.<span id="more-152"></span></p>
<pre>&lt;HTA:APPLICATION
    id="oDPBS"
    applicationname="DiskPartBootStrapper"
    border="thin"
    borderstyle="complex"
    caption="yes"
    contextmenu="no"
    selection="no"
    showintaskbar="yes"
    singleinstance="no"
    sysmenu="yes"
    scroll="auto"
    maximizebutton="yes"
    minimizebutton="yes"
    windowstate="normal"
    icon="myicon.ico"
&gt;
&lt;html&gt;
&lt;head&gt;
<span style="font-family:Courier New;">    </span>&lt;title&gt;Server Builder&lt;/title&gt;
<span style="font-family:Courier New;">    </span>&lt;style type="text/css"&gt; &lt;!--
<span style="font-family:Courier New;">        </span>body {
<span style="font-family:Courier New;">            </span>filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#ffffcc', EndColorStr='#adc3db');
<span style="font-family:Courier New;">            </span>border: 0;
<span style="font-family:Courier New;">            </span>xfont-family: "Verdana, Arial, Helvetica, sans-serif";
<span style="font-family:Courier New;">            </span>font:menu;
<span style="font-family:Courier New;">            </span>color:menutext;
<span style="font-family:Courier New;">            </span>xfont-size: 8pt;
<span style="font-family:Courier New;">            </span>background-color: #ffffdd;
<span style="font-family:Courier New;">            </span>background-position: top left;
<span style="font-family:Courier New;">            </span>background-repeat: no-repeat;
<span style="font-family:Courier New;">            </span>cursor:default;
<span style="font-family:Courier New;">        </span>}
<span style="font-family:Courier New;">        </span>input {
<span style="font-family:Courier New;">            </span>background: #f5f5dc;
<span style="font-family:Courier New;">            </span>font-family: verdana;
<span style="font-family:Courier New;">            </span>font-size: 8pt;
<span style="font-family:Courier New;">        </span>}
<span style="font-family:Courier New;">        </span>textarea {
<span style="font-family:Courier New;">            </span>background: #f5f5dc;
<span style="font-family:Courier New;">            </span>font-family: verdana;
<span style="font-family:Courier New;">            </span>font-size: 8pt;
<span style="font-family:Courier New;">        </span>}
<span style="font-family:Courier New;">        </span>select {
<span style="font-family:Courier New;">            </span>background: #f5f5dc;
<span style="font-family:Courier New;">            </span>font-family: verdana;
<span style="font-family:Courier New;">            </span>font-size: 8pt;
<span style="font-family:Courier New;">        </span>}
<span style="font-family:Courier New;">        </span>td {
<span style="font-family:Courier New;">            </span>font-family: verdana;
<span style="font-family:Courier New;">            </span>font-size: 8pt;
<span style="font-family:Courier New;">            </span>text-align: left;
<span style="font-family:Courier New;">            </span>text-decoration: none;
<span style="font-family:Courier New;">            </span>vertical-align: top;
<span style="font-family:Courier New;">        </span>}
    --&gt; &lt;/style&gt;
    &lt;script language="vbscript"&gt;
<span style="font-family:Courier New;">        </span>VersionNbr = "1.0"
<span style="font-family:Courier New;">        </span>ScriptLocation = Right(document.location, Len(document.location) - 8 )
<span style="font-family:Courier New;">        </span>ScriptLocation = Replace(ScriptLocation, "/", "\")
<span style="font-family:Courier New;">        </span>ScriptModified = document.lastmodified
<span style="font-family:Courier New;">        </span>document.title = document.title &amp; " (v" &amp; VersionNbr &amp; ")"
<span style="font-family:Courier New;">        </span>Dim objFSO, objFile, objShell
<span style="font-family:Courier New;">        </span>Dim OSstring 'used for both
<span style="font-family:Courier New;">        </span>Dim objDiskPartFile
<span style="font-family:Courier New;">        </span>Set objFSO = CreateObject("Scripting.FileSystemObject")
<span style="font-family:Courier New;">        </span>Set objShell = CreateObject("WScript.Shell")
<span style="font-family:Courier New;">        </span>Const ForWriting = 2
<span style="font-family:Courier New;">        </span>Dim TmplScriptLoc, DiskPartFile
<span style="font-family:Courier New;">        </span>TmplScriptLoc = "x:\diskpart.txt"
<span style="font-family:Courier New;">        </span>DiskPartFile = "x:\install.bat"
<span style="font-family:Courier New;">        </span>Dim numericCheck
<span style="font-family:Courier New;">        </span>Dim Regzing
<span style="font-family:Courier New;">        </span>Private Sub Window_onLoad
<span style="font-family:Courier New;">            </span>window.resizeTo 425,225
<span style="font-family:Courier New;">        </span>End Sub
<span style="font-family:Courier New;">        </span>Private Sub Button1Click
<span style="font-family:Courier New;">            </span>If IsNumeric(TextBox1.value) Then
<span style="font-family:Courier New;">                </span>RunProcess
<span style="font-family:Courier New;">            </span>Else
<span style="font-family:Courier New;">                </span>MsgBox("Please specify the size of the C: partition in GB")
<span style="font-family:Courier New;">            </span>End If
<span style="font-family:Courier New;">        </span>End Sub
<span style="font-family:Courier New;">        </span>Sub RunProcess
<span style="font-family:Courier New;">            </span>Select Case ComboBox1.value
<span style="font-family:Courier New;">                </span>Case "Windows 2003 Web Edition x86"
<span style="font-family:Courier New;">                    </span>Regzing = 1
<span style="font-family:Courier New;">                </span>Case "Windows 2003 Standard Edition x86"
<span style="font-family:Courier New;">                    </span>Regzing = 1
<span style="font-family:Courier New;">                </span>Case "Windows 2003 Standard Edition x64"
<span style="font-family:Courier New;">                    </span>Regzing = 1
<span style="font-family:Courier New;">                </span>Case "Windows 2003 Enterprise Edition x86"
<span style="font-family:Courier New;">                    </span>Regzing = 1
<span style="font-family:Courier New;">                </span>Case "Windows 2003 Enterprise Edition x64"
<span style="font-family:Courier New;">                    </span>Regzing = 1
<span style="font-family:Courier New;">                </span>Case Else
<span style="font-family:Courier New;">                    </span>Regzing = 0
<span style="font-family:Courier New;">            </span>End Select
<span style="font-family:Courier New;">            </span>'Math = GB to MB conversion
<span style="font-family:Courier New;">            </span>Dim Math
<span style="font-family:Courier New;">            </span>Math = TextBox1.value * 1024
<span style="font-family:Courier New;">            </span>'Diskpart template script
<span style="font-family:Courier New;">            </span>Dim Diskpart
<span style="font-family:Courier New;">            </span>Diskpart = "Select 0" &amp; vbCrLf _
<span style="font-family:Courier New;">                &amp; </span>"clean" &amp; vbCrLf &amp; _
<span style="font-family:Courier New;">                &amp; </span>"create partition primary size = " &amp; Math &amp; vbCrLf _
<span style="font-family:Courier New;">                &amp; </span>"active" &amp; vbCrLf _
<span style="font-family:Courier New;">                &amp; </span>"assign letter = c" &amp; vbCrLf _
<span style="font-family:Courier New;">                &amp; </span>"exit"
<span style="font-family:Courier New;">            </span>Set objFile = objFSO.OpenTextFile(TmplScriptLoc, ForWriting, True)
<span style="font-family:Courier New;">            </span>objFile.WriteLine Diskpart
<span style="font-family:Courier New;">            </span>objFile.Close
<span style="font-family:Courier New;">            </span>'Write script for Windows 2003
<span style="font-family:Courier New;">            </span>If Regzing = 1 Then
<span style="font-family:Courier New;">                </span>'Prepare Disk
<span style="font-family:Courier New;">                </span>OSstring = "regedit /s x:\support\REGTWEAKZ.reg &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"diskpart -s x:\diskpart.txt &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"format c: /q /y /v:OS /fs:NTFS &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"x:\support\bootsect.exe /NT52 all &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"xcopy /e z:\" &amp; combobox1.value &amp; "\$OEM$\$1\* c:\ &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"z:\" &amp; combobox1.value &amp; "\I386\WINNT32.exe /unattend:z:\" &amp; combobox1.value &amp; "\I386\complete.sif" &amp; vbCrLf &amp; _
                                        &amp; "exit"
<span style="font-family:Courier New;">            </span>Else
<span style="font-family:Courier New;">                </span>OSstring = "diskpart -s x:\diskpart.txt" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"format c: /q /y /v:OS /fs:NTFS &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"x:\support\bootsect.exe /NT60 all &gt; NUL" &amp; vbCrLf _
<span style="font-family:Courier New;">                    &amp; </span>"x:\process\setup.exe /wds /wdsdiscover /wdsserver:206.222.3.66 /unattend" &amp; combobox1.value
<span style="font-family:Courier New;">            </span>End If
<span style="font-family:Courier New;">            </span>Set objDiskPartFile = objFSO.OpenTextFile(DiskPartFile, ForWriting, True)
<span style="font-family:Courier New;">            </span>objDiskPartFile.WriteLine OSstring
<span style="font-family:Courier New;">            </span>objDiskPartFile.Close
<span style="font-family:Courier New;">        </span>End Sub
<span style="font-family:Courier New;">        </span>Sub AboutButtonClick
<span style="font-family:Courier New;">            </span>msgbox "Location: " &amp; ScriptLocation &amp; vbcrlf &amp; vbcrlf &amp; "Version: " &amp; VersionNbr &amp; vbcrlf &amp; vbcrlf &amp; "Modified: " &amp; ScriptModified, vbInformation + vbOKonly, "About the Script"
<span style="font-family:Courier New;">        </span>End Sub
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table width="100%" border="0" cellpadding="3" cellspacing="3"&gt;
    &lt;tr&gt;
        &lt;td&gt;Operating System:&lt;/td&gt;
        &lt;td&gt;
            &lt;select name="combobox1"&gt;
                &lt;option value="web32"&gt;Windows 2003 Web Edition x86&lt;/option&gt;
                &lt;option value="std32"&gt;Windows 2003 Standard Edition x86&lt;/option&gt;
                &lt;option value="std64"&gt;Windows 2003 Standard Edition x64&lt;/option&gt;
                &lt;option value="ent32"&gt;Windows 2003 Enterprise Edition x86&lt;/option&gt;
                &lt;option value="ent64"&gt;Windows 2003 Enterprise Edition x64&lt;/option&gt;
                &lt;option value="2k8webx86.xml"&gt;Windows 2008 Web Edition x86&lt;/option&gt;
                &lt;option value="2k8webx64.xml"&gt;Windows 2008 Web Edition x64&lt;/option&gt;
                &lt;option value="2k8dcx86.xml"&gt;Windows 2008 Datacenter Edition x86&lt;/option&gt;
                &lt;option value="2k8dcx64.xml"&gt;Windows 2008 Datacenter Edition x64&lt;/option&gt;
            &lt;/select&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Disk Space:&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="textbox1" value="10240"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td colspan="2"&gt;&lt;input type="button" value="Generate" onclick="Button1Click" style="width:90" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td colspan="2"&gt;&lt;hr /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;input type="button" value="About" onclick="AboutButtonClick" style="width:90" /&gt;&lt;/td&gt;
        &lt;td&gt;&lt;input type="button" value="Quit" onclick="javascript:window.close();" style="width:90" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=152&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/11/12/html-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>Enumerate the Properties of an Object</title>
		<link>http://codeslabs.wordpress.com/2008/11/06/143/</link>
		<comments>http://codeslabs.wordpress.com/2008/11/06/143/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 13:43:08 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=143</guid>
		<description><![CDATA[Have ever wanted to enumerate the properties of and object?  Here&#8217;s a slab that does just that. There&#8217;s lots of reasons why you might want to loop through an object&#8217;s properties.  Maybe you want to run some validation or apply business rules.  Maybe you&#8217;re just bored.  Whatever the reason, reflection helps us out. To complete [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=143&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Have ever wanted to enumerate the properties of and object?  Here&#8217;s a slab that does just that.<span id="more-143"></span></p>
<p>There&#8217;s lots of reasons why you might want to loop through an object&#8217;s properties.  Maybe you want to run some validation or apply business rules.  Maybe you&#8217;re just bored.  Whatever the reason, reflection helps us out. To complete this exercise, start a new project with a form (Form1) and a class (Class1). Drop a listbox on the form, and place these blocks in the code:</p>
<pre>Public Class Class1
    Public Sub New()
        MyBase.new()
    End Sub
    Private _Prop1 As String
    Public Property Prop1() As String
        Get
            Return _Prop1
        End Get
        Set(ByVal value As String)
            _Prop1 = value
        End Set
    End Property
    Private _Prop2 As String
    Public Property Prop2() As String
        Get
            Return _Prop2
        End Get
        Set(ByVal value As String)
            _Prop2 = value
        End Set
    End Property
    Private _Prop3 As Integer
    Public Property Prop3() As Integer
        Get
            Return _Prop3
        End Get
        Set(ByVal value As Integer)
            _Prop3 = value
        End Set
    End Property
    Private _Prop4 As DateTime
    Public Property Prop4() As DateTime
        Get
            Return _Prop4
        End Get
        Set(ByVal value As DateTime)
            _Prop4 = value
        End Set
    End Property
End Class
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim NewObj As New Class1
        NewObj.Prop1 = "Hello"
        NewObj.Prop2 = "World"
        NewObj.Prop3 = 4
        NewObj.Prop4 = "10/31/2008"
        Dim type As Type = NewObj.GetType()
        Dim properties() As System.Reflection.PropertyInfo = type.GetProperties()
        For Each p As System.Reflection.PropertyInfo In properties
            ListBox1.Items.Add(p.Name &amp; ": " &amp; p.GetValue(NewObj, Nothing))
        Next
    End Sub
End Class</pre>
<p>That should do it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=143&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/11/06/143/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>Manually Updating a ClickOnce Deployed Application</title>
		<link>http://codeslabs.wordpress.com/2008/11/03/manually-updating-a-clickonce-deployed-application/</link>
		<comments>http://codeslabs.wordpress.com/2008/11/03/manually-updating-a-clickonce-deployed-application/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 13:23:19 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=140</guid>
		<description><![CDATA[Under certain circumstances, you may not want an app to automagically update itself.  This slab shows how to do it manually. When and where you can, you should use the automatic application update for ClickOnce published apps. To do this: Double click My Project in the Solution Explorer. Navigate to the Publish tab. Click the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=140&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Under certain circumstances, you may not want an app to automagically update itself.  This slab shows how to do it manually.<span id="more-140"></span></p>
<p>When and where you can, you should use the automatic application update for ClickOnce published apps. To do this:</p>
<ul>
<li>Double click My Project in the Solution Explorer.</li>
<li>Navigate to the Publish tab.</li>
<li>Click the Updates&#8230; button.</li>
<li>Check &#8220;The application should check for updates&#8221;.</li>
<li>Check &#8220;Before the application starts&#8221;.</li>
</ul>
<p>Otherwise, leaving &#8220;The application should check for updates&#8221; unchecked implies that updates will be handled manually. That&#8217;s what the code below does.</p>
<p><strong>Plagarism note</strong>: This code is based on the MSDN article: <a title="MSDN How Do I? Video" href="http://msdn.microsoft.com/en-us/vbasic/cc308403.aspx" target="_blank">How Do I: Use the ClickOnce Deployment API to Update My App?</a></p>
<p>Start a new Windows form project.  Add a button to Form1.  Then, put this code behind Form1:</p>
<pre>Imports System.Deployment.Application

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ad As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
        Dim info As UpdateCheckInfo = ad.CheckForDetailedUpdate

        If Not info.UpdateAvailable Then
            MsgBox("No updates are availible.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Notice")
            Return
        End If

        Dim DoUpdate As Boolean = True

        If info.IsUpdateRequired Then
            MsgBox("There is a required update availible.  Downloading now.", _
		MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Notice")
        Else
            If MsgBox("Update availible; download now?", _
		MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Question") = MsgBoxResult.No Then

		DoUpdate = False
            End If
        End If

        If DoUpdate Then
            ad.Update()
            MsgBox("The updates have been applied.  The application must now be restarted.", _
		MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Notice")

		Application.Restart()
        End If
    End Sub
End Class</pre>
<p>A good use of this might be to adapt the code to do the check asynchronously (in form_load, for instance), by changing the code that sets info&#8217;s value:</p>
<pre>Dim info As UpdateCheckInfo = ad.CheckForUpdateAsync</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/140/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=140&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/11/03/manually-updating-a-clickonce-deployed-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>The Missing Forms Collection</title>
		<link>http://codeslabs.wordpress.com/2008/10/29/the-missing-forms-collection/</link>
		<comments>http://codeslabs.wordpress.com/2008/10/29/the-missing-forms-collection/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 11:50:33 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=129</guid>
		<description><![CDATA[In VB6 we had Me.Forms; what happened? People stopped needing it, I guess. If you do though, here&#8217;s a slab to get you through. With a little bit of reflection, we can get the list.  Start a new project with three forms.  Drop a listbox and a button on Form1, then put this behind it: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=129&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In VB6 we had Me.Forms; what happened? People stopped needing it, I guess. If you do though, here&#8217;s a slab to get you through.<span id="more-129"></span></p>
<p>With a little bit of reflection, we can get the list.  Start a new project with three forms.  Drop a listbox and a button on Form1, then put this behind it:</p>
<pre>Public Class Form1
    Public Forms as New Generic.List(Of String)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim MyTypes As Type() = Reflection.Assembly.GetExecutingAssembly.GetTypes
        For Each mType As Type In MyTypes
            If mType.BaseType Is GetType(Form) Then
                Dim frmname As String = mType.UnderlyingSystemType.ToString
                If frmname &lt;&gt; My.Application.Info.AssemblyName &amp; "." &amp; Me.Name Then
                    frmname = frmname.Replace(My.Application.Info.AssemblyName &amp; ".", "")
                    ListBox1.Items.Add(frmname)
                    Forms.Add(frmname)
                End If
            End If
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ListBox1.Text = "" Then Exit Sub

        Dim NewForm As Object _
            = Activator.CreateInstance(Type.GetType(My.Application.Info.AssemblyName &amp; "." &amp; ListBox1.Text))
        DirectCast(NewForm, Form).Show()
    End Sub
End Class</pre>
<p>When you run it, the listbox will have Form2 and Form3 in it. Clicking the button will bring up that form. Me.Forms will also have the two members as expected. If you want Form1 included, omit the test for it in Form1_Load.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=129&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/10/29/the-missing-forms-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
		<item>
		<title>Find Controls on a webform</title>
		<link>http://codeslabs.wordpress.com/2008/10/28/find-controls-on-a-webform/</link>
		<comments>http://codeslabs.wordpress.com/2008/10/28/find-controls-on-a-webform/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 21:58:36 +0000</pubDate>
		<dc:creator>kueue</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=132</guid>
		<description><![CDATA[These two methods will allow you to generically locate a collection of Controls on any webform.It recursively locates controls so no knowledge of control hierarchy is required. This bit of code come in very handy when dealing with repeaters. /// /// Find all controls with specified ID /// /// The control ID to search for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=132&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>These two methods will allow you to generically locate a collection of Controls on any webform.<span id="more-132"></span>It recursively locates controls so no knowledge of control hierarchy is required.  This bit of code come in very handy when dealing with repeaters.</p>
<pre style="padding-left:30px;">
///
/// Find all controls with specified ID
///
/// The control ID to search for
/// List of all controls found
public List FindControls(string ID)
{
    List foundControls = new List();
    this.FindControlsRecursive(ref foundControls, this.Master, ID);
    return foundControls;
}

private List FindControlsRecursive(ref List foundControls, Control root, string ID)
{
    foreach (Control ctrl in root.Controls)
    {
        if (ctrl.ID == ID)
            foundControls.Add(ctrl);

        FindControlsRecursive(ref foundControls, ctrl, ID);
    }

     return foundControls;
}
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=132&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/10/28/find-controls-on-a-webform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24f92fb56392efa8c3b7bd7ae8bfab89?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">kueue</media:title>
		</media:content>
	</item>
		<item>
		<title>Useful SSRS Report Footer Items</title>
		<link>http://codeslabs.wordpress.com/2008/10/21/useful-ssrs-report-footer-items/</link>
		<comments>http://codeslabs.wordpress.com/2008/10/21/useful-ssrs-report-footer-items/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 12:58:36 +0000</pubDate>
		<dc:creator>TheGreyMan</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://codeslabs.wordpress.com/?p=127</guid>
		<description><![CDATA[If you want to do your users a service, standardize on displaying certain things on your reports. This slab is a cheat sheet for doing just that. One of the goals of a well thought out report system is to help everyone get to &#8220;one version of the truth&#8221;. To that end, it is a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=127&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to do your users a service, standardize on displaying certain things on your reports.  This slab is a cheat sheet for doing just that.<span id="more-127"></span><br />
One of the goals of a well thought out report system is to help everyone get to &#8220;one version of the truth&#8221;.  To that end, it is a good idea to display a standard list of items.  Here&#8217;s my basic list:</p>
<p><strong>A Report Identifier</strong>:<br />
This is important because it allows people to easily communicate about a particular report.  For instance, your sales director may want to talk to the CFO about something on a given report.  It&#8217;s a lot easier to &#8220;report XYZrpt015&#8243; that a fully qualified URL.  What your standard is is up to you, but I recommend a two or three char system identifier (i.e., ACC for Accounting, or WMS for warehouse management) and a number.</p>
<p><strong>The location of where to find the report</strong>:<br />
<code>=Replace(Globals!ReportServerUrl,"localhost","ServerName") &amp; Globals!ReportFolder &amp; "/" &amp; Globals!ReportName</code><br />
Notice the use of the Replace function; I do this because The ReportServerUrl has Localhost in it, and if you have multiple SSRS installations&#8230; you get the idea.</p>
<p><em>Tip: set the Action of this textbox to Link.  Not terribly useful by itself, but when exported, the link will work.</em></p>
<p><strong>Date Printed</strong>:<br />
<code>Printed: [&amp;ExecutionTime]</code></p>
<p><strong>Page Numbers</strong>:<br />
<code>Page [&amp;PageNumber] of [&amp;TotalPages]</code></p>
<p><strong>Parameters</strong>:<br />
I recommend you list all params on your report.  It provides insight into what this report is about, and in certain situations, allows the report to be run again with the same params.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeslabs.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeslabs.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeslabs.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeslabs.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeslabs.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeslabs.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeslabs.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeslabs.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeslabs.wordpress.com&amp;blog=5053026&amp;post=127&amp;subd=codeslabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeslabs.wordpress.com/2008/10/21/useful-ssrs-report-footer-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2022878814208cac93ab5d769865241b?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">lanmind</media:title>
		</media:content>
	</item>
	</channel>
</rss>
