<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Ronda's Web Log</title>
    <description>Ronda's Web log</description>
    <link>http://www.streetcoder.com/blog/</link>
    <language>en-US</language>
    <docs>http://www.streetcoder.com/blog/BlogFeed.asmx/GetRSS?</docs>
    <webMaster>rka@streetcoder.com</webMaster>
    <lastBuildDate>Wed, 08 Sep 2010 03:21:54 GMT</lastBuildDate>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=27</guid>
      <title>Total Summary Rows in Datagrid with DataItem</title>
      <description>There are a gazillion ways to create a summary row in the footer of a datagrid.  I think this is one of the slicker, faster ways.  Using the dataitem enables you to use friendly names and variables throughout  - so when you have many many columns it makes it a lot easier to keep track and manage.&lt;br&gt;&lt;blockquote&gt;&lt;font color=red&gt;&lt;br&gt;Declare some integers for holding the values&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;&lt;font color=blue&gt;&lt;br&gt;Private MonthlyGoal As Integer = 0&lt;br&gt;Private FiscalYrYTD As Integer = 0&lt;br&gt;&lt;/font&gt;&lt;br&gt;&lt;font color=red&gt;In your Databound event add up the values:&lt;/font color=red&gt;&lt;br&gt;&lt;font color=blue&gt;&lt;br&gt;Public Sub dgAttainment_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)&lt;br&gt;&lt;br&gt;	If e.Item.ItemType = ListItemType.Item Or _&lt;br&gt;	e.Item.ItemType = ListItemType.AlternatingItem Then&lt;/font&gt;&lt;br&gt;&lt;font color=red&gt;‘add the items as you bind each row&lt;br&gt;‘Intellisense will not have the datafield name when you choose &lt;br&gt;‘e.item.dataitem but just add it anyways – it is the datafield&lt;br&gt;‘that you have used in your datagrid column&lt;/font color=red&gt;&lt;br&gt;	&lt;font color=blue&gt;MonthlyGoal += e.Item.DataItem.MonthlyGoal&lt;br&gt;FiscalYrYTD += e.Item.DataItem.FiscalYrYTD&lt;br&gt;&lt;br&gt;ElseIf (e.Item.ItemType = ListItemType.Footer) Then&lt;/font&gt;&lt;br&gt;&lt;font color=red&gt;‘put the added values into the appropriate column in the footer&lt;/font color=red&gt;&lt;br&gt;&lt;font color=blue&gt;&lt;br&gt;          e.Item.Cells(6).Text = FormatCurrency(MonthlyGoal, 2)&lt;br&gt;          e.Item.Cells(9).Text = FormatCurrency(FiscalYrYTD, 2)&lt;br&gt;&lt;br&gt;end if&lt;br&gt;&lt;br&gt;End Sub&lt;br&gt;&lt;/font&gt;&lt;/blockquote&gt;</description>
      <pubDate>Wed, 16 Jan 2008 08:43:24 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=27</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=24</guid>
      <title>Community Server</title>
      <description>WOW.... those guys at &lt;a href="http://telligent.com/"&gt;telligent &lt;/a&gt; are really on the ball.  I installed community server for my hometown and haven't advertised it yet but it looks like it is truly going to rock!&lt;br&gt;&lt;br&gt;I installed it here &lt;A href="http://downtowncleburne.com/cs/Default.aspx" target="_blank"&gt;http://downtowncleburne.com/cs/Default.aspx&lt;/A&gt; but plan on changing the URL soon&lt;br&gt;&lt;br&gt;I am trying to get some folks in the area to add some commentary before I start exploring avenues for disseminating it to the public.  Take a look and please feel free to send me any comments regarding Forums/Blogs or other content.&lt;br&gt;&lt;br&gt;I am looking forward to seeing how receptive the public is to this project.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;&lt;br&gt;Ronda&lt;br&gt;</description>
      <pubDate>Wed, 23 Aug 2006 18:54:14 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=24</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=22</guid>
      <title>Populate a DropDown List from SQL Query</title>
      <description>&lt;blockquote&gt; &lt;font color=red&gt;'Declare your connection, command and SQL&lt;/font color=red&gt;&lt;br&gt;Dim myConnection As SqlConnection&lt;br&gt;Dim myCommand As SqlCommand&lt;br&gt;Dim strSQL As String&lt;br&gt;&lt;font color=red&gt;'Assign your values&lt;/font color=red&gt;&lt;br&gt;'I have concatenated the partnumber with the product name for ease of the user&lt;br&gt; strSQL = "select item_id,part_number,(part_number + '-' + productname) as theitem FROM  products "&lt;br&gt;myConnection = New SqlConnection(conString)&lt;br&gt;myCommand = New SqlCommand(strSQL, myConnection)&lt;br&gt;&lt;font color=red&gt;'Open your connection&lt;/font color=red&gt;&lt;br&gt;myConnection.Open()&lt;br&gt;&lt;font color=red&gt;'My dropdownlist is named drpProducts&lt;/font color=red&gt;&lt;br&gt;drpProducts.DataSource = myCommand.ExecuteReader()&lt;br&gt;&lt;font color=red&gt;'Use the values from the SQL to populate the text and value fields of dropdown&lt;/font color=red&gt;&lt;br&gt;drpProducts.DataTextField = "theitem"&lt;br&gt;drpProducts.DataValueField = "item_ID"&lt;br&gt;drpProducts.DataBind()&lt;br&gt;&lt;font color=red&gt;'Give your dropdownlist a default value&lt;/font color=red&gt;&lt;br&gt;drpProducts.Items.Insert(0, "Choose Item")&lt;br&gt;&lt;font color=red&gt;'Close your connection&lt;/font color=red&gt;&lt;br&gt; myConnection.Close()&lt;/blockquote&gt;</description>
      <pubDate>Tue, 24 May 2005 06:27:21 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=22</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=21</guid>
      <title>ExecuteScaler to populate a label </title>
      <description>Easy example of using ExecuteScaler to populate a single value &lt;br&gt;&lt;br&gt;&lt;blockquote&gt;&lt;br&gt;&lt;font color=red&gt;'Declare your connection &amp; command objects along with your SQL String&lt;/font color=red&gt;&lt;br&gt;Dim myConnection As SqlConnection&lt;br&gt;Dim myCommand As SqlCommand&lt;br&gt;Dim strSQL As String&lt;br&gt;&lt;font color=red&gt;'Build your SQL and populate your other values&lt;/font color=red&gt;&lt;br&gt;strSQL = "select myPrice FROM  myproducts where itemid= " &amp; drpProducts.SelectedItem.Value&lt;br&gt;myConnection = New SqlConnection(conString)&lt;br&gt;myCommand = New SqlCommand(strSQL, myConnection)&lt;br&gt;&lt;font color=red&gt;'Open your connection&lt;/font color=red&gt;&lt;br&gt;myConnection.Open()&lt;br&gt;&lt;font color=red&gt;'Assign your retrieved value to an object&lt;/font color=red&gt;&lt;br&gt;lblItemPrice.Text = myCommand.ExecuteScalar()&lt;br&gt;&lt;font color=red&gt;'Close your connection&lt;/font color=red&gt;&lt;br&gt;myConnection.Close()&lt;/blockquote&gt;</description>
      <pubDate>Tue, 24 May 2005 06:20:50 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=21</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=18</guid>
      <title>Busier than a ...</title>
      <description>It has been SO long since I have blogged I had to look up my admin page to create this entry.  I bought a new house - which is going to be awesome after a LOT of work.  It is 1930's rock cottage right in the midst of town on an acre of land with all kinds of kitschy out buildings and character.  I still have a house in Dallas to sell - thus am making two house payments right now if anyone is thinking of relocating - I am becoming more and more negotiable as the weeks roll by.&lt;br&gt;&lt;br&gt;Oh on the subject of remodeling - I offer a tidbit of wisdom -- NEVER buy cheap sandpaper when sanding wood floors.  Always spring for the most expensive stuff&lt;br&gt;&lt;br&gt;&lt;blockquote&gt;I came across a rollover image control that Chris Garrett put together - I don't usually do rollovers but am trading out a web site for a heavy metal band (they are doing some construction for me) and they want rollovers. I started to do it with client side javascript and googled it with .net and found this clean, neat little &lt;A href="http://aspalliance.com/317" target="_blank"&gt;user control&lt;/A&gt; to throw into your library.&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;I finally had some time tonight and spent a couple of hours in the microsoft newsgroups - it is amazing how much time programmers &lt;b&gt;don't &lt;/b&gt; have - most especially if they have any outside interests like gardening, moving, side-work to support double house payments, not to mention any kind of social life (right).  My listservers are all going to my gmail account (which really is the best solution in the world for lists) and I haven't checked it in more than a week or two- so I almost want to go in and just archive everything but I have never been able to do that.  I really do admire those of you with clean mailboxes - I keep almost everything; which results in tons of folders for organinzing and lots of archived .pst files.&lt;br&gt;&lt;br&gt;When I started this post I had some interesting items (VB.net) to mention but they are eluding me now - so maybe I will consolidate my thoughts, empty out my pda, get my notes together (darn I have been meaning to install one-note) and try another post soon... ~ &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</description>
      <pubDate>Tue, 05 Apr 2005 23:43:01 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=18</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=17</guid>
      <title>Mobility To Go Roadshow</title>
      <description>On Tuesday I attended the &lt;A href="http://www.msmobilityroadshow.com" target="_blank"&gt;.Net To Go Mobility Roadshow&lt;/A&gt; and really enjoyed it.  It looks like the show is about done but if you get the chance to catch it in the future, well it is a winner!  Thom Robbins was one of the most compelling and inspiring speakers I have heard, he has a conversational style and excellent timing that prevents one from ever glancing at the clock.&lt;br&gt;&lt;br&gt;I was fortunate and scored "The Definitive Guide to the .Net Compact Framework" which was nice since my 'Hello App' was created before I went to bed that night and it has been a good resource while working on a CF project all week in my free time (like programmers ever really have free time - so much to learn).  The framework is not so different than any other .Net development but there are limitations and nuances to deal with and I haven't yet ventured into ADO with the SQLServerCE so I have some challenges ahead.&lt;br&gt;&lt;br&gt;Robbins offered a challenge for a free CF Device and I thought a few of you may want to rise to the challenge.  His October 20th post on his blog &lt;A href="http://weblogs.asp.net/trobbins" target="_blank"&gt;http://weblogs.asp.net/trobbins&lt;/A&gt; has all of the details.  Basically submit an app and the top 5% will score  "A Windows Powered Mobile Device!", either a phone or PDA.&lt;br&gt;</description>
      <pubDate>Sat, 13 Nov 2004 11:27:35 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=17</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=11</guid>
      <title>Stored Procedure to DataSet - Easy Example</title>
      <description>Most of the stored procedure examples out there seem to be for tying the data to a datagrid.  But if you are working with XML or need a Dataset you may want an easy example to fill a dataset with your Stored Procedure returned data.  Here goes...&lt;br&gt; &lt;blockquote&gt;'Set up your connection Info&lt;br&gt;        &lt;font color=red&gt;Dim conDB As New SqlConnection(Me.conString)&lt;br&gt;        Dim Command As New SqlClient.SqlCommand("GetVendorOrders")&lt;br&gt;        Command.CommandType = CommandType.StoredProcedure&lt;br&gt;        Command.Connection = conDB&lt;/font color=red&gt;        &lt;br&gt;&lt;br&gt;        'Create your  Parameters (I created 2)&lt;br&gt;        &lt;font color=red&gt;Dim vendorCode As New SqlClient.SqlParameter()&lt;br&gt;        vendorCode.ParameterName = "@vendorCode"&lt;br&gt;        vendorCode.SqlDbType = SqlDbType.NVarChar&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;        &lt;font color=red&gt;Dim marking As New SqlClient.SqlParameter()&lt;br&gt;        marking.ParameterName = "@flaggedValue"&lt;br&gt;        marking.SqlDbType = SqlDbType.Int&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;        'Set Parameter Values&lt;br&gt;        &lt;font color=red&gt;vendorCode.Value = "AZ"&lt;br&gt;        marking.Value = 3&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;        'Add your Parameters&lt;br&gt;        &lt;font color=red&gt;Command.Parameters.Add(vendorCode)&lt;br&gt;        Command.Parameters.Add(marking)&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;        'Create DataAdapter  and place into Dataset&lt;br&gt;        &lt;font color=red&gt;Dim daSalesByCategory As New SqlClient.SqlDataAdapter()&lt;br&gt;        daSalesByCategory.SelectCommand = Command&lt;br&gt;        Dim dsOrders As New DataSet()&lt;br&gt;        daSalesByCategory.Fill(dsOrders)&lt;/font color=red&gt;&lt;/blockquote&gt;&lt;br&gt;It really doesn't get any easier than that... gotta love .Net!</description>
      <pubDate>Mon, 04 Oct 2004 11:25:12 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=11</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=10</guid>
      <title>Return Values from Stored Procedure</title>
      <description>When dealing with multiple tables and you need to connect them with common information such as the ID of an order it is often necessary to insert a record, get back the ID and then go on to do other things utilizing that ID.  The easiest way is using the @@Identity of the first table.&lt;br&gt;&lt;br&gt;Example Sproc might look something like this:&lt;br&gt;&lt;blockquote&gt;&lt;font color=red&gt;Create Procedure "InsertnewOrder"&lt;br&gt;&lt;br&gt;As&lt;br&gt;&lt;br&gt;Insert into Orders(orderDate, orderStatus) Values(getdate(),'Shopping')&lt;br&gt;&lt;br&gt;RETURN (@@IDENTITY) &lt;/font color=red&gt; &lt;/blockquote&gt; &lt;br&gt;In our page we could do something like this to get back the ID of the new record:&lt;br&gt;           &lt;blockquote&gt;&lt;font color=red&gt; Dim myCon As SqlConnection&lt;br&gt;            myCon = New SqlConnection(conString)&lt;br&gt;            Dim myCmd As SqlCommand&lt;br&gt;            myCmd = New SqlCommand("InsertnewOrder", myCon)&lt;br&gt;            myCmd.CommandType = CommandType.StoredProcedure&lt;br&gt;            myCmd.Parameters.Add("@return", SqlDbType.Int)&lt;br&gt;            myCmd.Parameters("@return").Direction = ParameterDirection.ReturnValue&lt;br&gt;            myCon.Open()&lt;br&gt;            myCmd.ExecuteNonQuery()&lt;br&gt;            Session("orderID") = myCmd.Parameters("@return").Value.ToString()&lt;/font color=red&gt;&lt;/blockquote&gt;&lt;br&gt;That is about it... pretty simple huh?</description>
      <pubDate>Sun, 03 Oct 2004 11:32:35 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=10</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=9</guid>
      <title>Create a printable page</title>
      <description>In your Page Load or wherever you want it  - add attributes for a Print button.  Because my content is small I made a small popup window.&lt;br&gt;&lt;font color=red&gt;&lt;blockquote&gt;butPrint.Attributes.Add("onclick", "window.open('http://www.mydomain.com/myfolder/temp.html',null,'height=400, focus=yes,width=450,status= no, resizable= yes, scrollbars=yes, toolbar=yes,location=no,menubar=yes ');")&lt;/blockquote&gt;&lt;/font&gt;&lt;br&gt;For this example I put the content of what I wanted to print into a Label (lblOutput) &lt;br&gt;&lt;br&gt;When I pulled the content from the database I went ahead and made a temp file with the content I wanted to print&lt;br&gt;&lt;font color=red&gt;&lt;blockquote&gt;Dim sw As StreamWriter&lt;br&gt;sw = File.CreateText("C:\webs\myWebPath\www\foldername\temp.html")&lt;br&gt;        sw.WriteLine("&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body onload='self.focus();'&amp;gt;")&lt;br&gt;        sw.WriteLine(lblOutput.Text)&lt;br&gt;        sw.WriteLine("&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;")&lt;br&gt;        sw.Close()&lt;/blockquote&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;I also set my Print button to visible at this time to assure I had content in my file before I allowed the visitor to print&lt;br&gt;&lt;blockquote&gt; &lt;font color=red&gt;butPrint.Visible = True&lt;/font color=red&gt;&lt;/blockquote&gt;&lt;br&gt;That is a pretty simple way to get only the items you want into a page.  You may want to clean up and delete the temp.html page when the visitor leaves.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;        &lt;br&gt;&lt;br&gt;&lt;br&gt;       </description>
      <pubDate>Sat, 25 Sep 2004 07:48:32 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=9</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=8</guid>
      <title>Make Excel Report from Datagrid</title>
      <description>Frequently it is convenient to be able to download a report in an Excel format.  This is a quick and easy way to turn your datagrid into an excel report.&lt;br&gt;&lt;br&gt;Make your subroutine to create your datagrid&lt;br&gt;&lt;br&gt;  &lt;blockquote&gt; &lt;font color=red&gt;Sub pullRecords(ByVal sender As System.Object, ByVal e As System.EventArgs)&lt;/font&gt;&lt;br&gt;        &lt;br&gt;'I have eliminated code to build the SQL String but basically create a datagrid in this subroutine like you normally would&lt;br&gt;    &lt;br&gt;&lt;font color=red&gt;&lt;br&gt;    &lt;br&gt;        Dim dreader As System.Data.SqlClient.SqlDataReader&lt;br&gt;        dreader = cmdReturn.ExecuteReader(CommandBehavior.CloseConnection)&lt;br&gt;        dgOrders.DataSource = dreader&lt;br&gt;        dgOrders.DataBind()&lt;br&gt;    &lt;br&gt;&lt;br&gt;        dreader.Close()&lt;br&gt;        conDB.Close()&lt;br&gt;        conDB.Dispose()&lt;br&gt;&lt;br&gt;    End Sub&lt;/font color=red&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;Okay once you have your datagrid returning to the page to send it to an Excel Doc do something like this:&lt;br&gt;&lt;br&gt;&lt;font color=red&gt;&lt;blockquote&gt;Sub downloadReport(ByVal sender As System.Object, ByVal e As System.EventArgs)&lt;br&gt;        pullRecords(sender, e)&lt;br&gt;        ' Set the content type to Excel.&lt;br&gt;        Response.ContentType = "application/vnd.ms-excel"&lt;br&gt;        ' Remove the charset from the Content-Type header.&lt;br&gt;        Response.Charset = ""&lt;br&gt;        ' Turn off the view state.&lt;br&gt;        Me.EnableViewState = False&lt;br&gt;&lt;br&gt;        Dim tw As New System.IO.StringWriter()&lt;br&gt;        Dim hw As New System.Web.UI.HtmlTextWriter(tw)&lt;br&gt;&lt;br&gt;        ' Get the HTML for the control.&lt;br&gt;        dgOrders.RenderControl(hw)&lt;br&gt;        ' Write the HTML back to the browser.&lt;br&gt;        Response.Write(tw.ToString())&lt;br&gt;        ' End the response.&lt;br&gt;        Response.End()&lt;br&gt;    End Sub&lt;/blockquote&gt;&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;I have initiated the creation of my Excel Report with a button on the page but you could incorporate it other ways.  </description>
      <pubDate>Sat, 25 Sep 2004 07:18:22 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=8</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=6</guid>
      <title>Hiding Panels</title>
      <description>I like to design many of my sites in ONE page.  Thus I tend to use panels to hide/display various controls that are typically fired off my button events.  One of the problems with this type of design is that you need to hide various panels when you show others to keep your page neat.  I have a function that I use that will search my page for panels and hide them all.  I run this right before I show a new panel to make sure the previous selection is not still displayed in my page.&lt;br&gt;&lt;br&gt;To call it I pass it the name of my page form - If you don't name your forms the default is typically "Form1":&lt;br&gt;&lt;br&gt;&lt;font color=red&gt;HidePanels(Page.FindControl("PortalForm"))&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;The simple little Sub looks like this:&lt;br&gt;&lt;br&gt;&lt;blockquote&gt;Sub HidePanels(ByVal x As Object)&lt;br&gt;     Dim ctlControl As Control&lt;br&gt;        For Each ctlControl In x.Controls&lt;br&gt;            If ctlControl.ToString() = "System.Web.UI.WebControls.Panel" Then&lt;br&gt;                ctlControl.Visible = False&lt;br&gt;            End If&lt;br&gt;        Next&lt;br&gt; End Sub&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;Not much to it really but it negates having to worry about adding and hiding new panels and is a handy little snippet.</description>
      <pubDate>Thu, 15 Apr 2004 11:09:54 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=6</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=3</guid>
      <title>Parameterize your SQL</title>
      <description>&lt;b&gt;Parameterize your SQL&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;I use a lot of stored procedures in my programming but occasionally I will bypass the sproc because I know it is rarely going to be used or maybe it is a temporary page and I don't want to clutter up my DB.  In those instances when I make an in-page query I thankfully use parameterized SQL wherever I can.  Some of the benefits are:&lt;br&gt;&lt;ul&gt;&lt;li&gt;Negates having to fight apostrophes in your data&lt;li&gt;Much easier to make changes to the Query without worrying about text delimiters&lt;li&gt;Easier to find your variables for troubleshooting since they are all grouped nicely together.&lt;li&gt;Offers more protection from injected SQL attacks&lt;/ul&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;The old way we may have done this insert statement may have been:&lt;/b&gt;&lt;br&gt;&lt;font color=red&gt;&lt;font class="code"&gt;&lt;br&gt;sql= "Insert into tblGroup (Firstname, Lastname, Email) Values ('" &amp; txtFirstname.text &amp; "', '" &amp; txtLastName.text &amp; "', '" &amp; txtEmail.text &amp; "')"&lt;/font&gt;&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;The way to do it with Parameterized SQL:&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;font color=red&gt;&lt;font class="code"&gt;&lt;br&gt;&lt;br&gt;Dim fname as string = txtFirstname.text&lt;br&gt;Dim lname as string = txtLastname.text&lt;br&gt;Dim email as string = txtEmail.text&lt;br&gt;&lt;br&gt;With cmd.Parameters:&lt;br&gt;	&amp;nbsp;&amp;nbsp;&amp;nbsp;.Add(New SQLParameter("@Firstname", fname))&lt;br&gt;	&amp;nbsp;&amp;nbsp;&amp;nbsp;.Add(New SQLParameter("@LastName", lname))&lt;br&gt;	&amp;nbsp;&amp;nbsp;&amp;nbsp;.Add(New SQLParameter("@email", email))&lt;br&gt;end with&lt;br&gt;&lt;br&gt;sql= "Insert into tlbGroup (Firstname, Lastname, Email) Values (@Firstname, @LastName, @Email)" &lt;/font&gt;&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;Doesn't really look like much in this example.  But when you put a query together with 20 or 30 variables, joins, unions etc... your errors will be fewer and easier to spot!&lt;br&gt;</description>
      <pubDate>Sun, 11 Apr 2004 00:04:55 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=3</comments>
    </item>
    <item>
      <guid isPermaLink="true">http://www.streetcoder.com/blog/DisplayBlog.aspx?permalink=2</guid>
      <title>Printable Window with content</title>
      <description>I secretly chuckle at programmers who write brilliant code but admit that they don't know HTML.  I on the other hand have never taken the time to learn much JavaScript, so this morning when I needed to open a new window - a printable window - that only contained the contents of a label which was built from a dataset, I was at a loss.  I found lots of examples of adding code behind script for alert windows but very few that allowed me to add a new window with content from my existing dynamic page.  &lt;br&gt;&lt;br&gt;I ended up creating a temp.html document on the fly and then opening that with Javascript.  Here is what I did:&lt;br&gt;&lt;br&gt;In my subroutine that created my detail view, where I write to my output label.  Right after I created my output I went ahead and created a temp.html file.&lt;br&gt;&lt;br&gt;&lt;br&gt;        &lt;font color=red&gt;Dim sw As StreamWriter&lt;br&gt;        sw = File.CreateText("D:\mypath\Management\temp.html")&lt;br&gt;        sw.WriteLine("&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body onload='self.focus();'&amp;gt;")&lt;br&gt;        sw.WriteLine(lblOutput.Text)&lt;br&gt;        sw.WriteLine("&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;")&lt;br&gt;        sw.Close()&lt;br&gt;        butPrint.Visible = True&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;In my pageload I went ahead and attached the javascript to the button&lt;br&gt;&lt;br&gt; &lt;font color=red&gt;butPrint.Attributes.Add("onclick", "window.open('http://www.mypath.com/temp.html',null,'height=400, width=450,status= no, resizable= yes, scrollbars=yes, toolbar=yes,location=no,menubar=yes ');")&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;It worked out very well for my purposes.  The body onload='self.focus();' assured that everytime a different detail view was requested my external printable window had focus.  This was a nice addition since that would be the first call from the office "I can't find my window!"&lt;br&gt;&lt;br&gt;Incidentally you will need the proper references:&lt;br&gt;&lt;font color=red&gt;Imports System.IO&lt;br&gt;Imports System.Net&lt;/font color=red&gt;&lt;br&gt;&lt;br&gt;Anyways it was a little challenge but occupied my Saturday morning..... now off to clean the house!&lt;br&gt;&lt;br&gt;</description>
      <pubDate>Sat, 10 Apr 2004 12:20:37 GMT</pubDate>
      <author>Ronda Pederson&lt;rka@streetcoder.com&gt;</author>
      <comments>http://www.streetcoder.com/blog/AddComment.aspx?blogID=2</comments>
    </item>
  </channel>
</rss>