Posts
1147
Comments
891
Trackbacks
1
February 2007 Blog Posts
T-SQL: Mimicking Merge Statement in SQL Server 2005

http://sqlserver-tips.blogspot.com/2006/09/mimicking-merge-statement-in-sql.html

posted @ Thursday, February 08, 2007 1:36 PM | Feedback (0)
.NET: Selecting DropDownList Item by Some Text or Value

myDropDown.SelectedIndex = myDropDown.Items.IndexOf(myDropDown.items.FindByText(Text))

myDropDown.SelectedIndex = myDropDown.Items.IndexOf(myDropDown.items.FindByValue(Value))

posted @ Sunday, February 04, 2007 6:17 AM | Feedback (0)
.NET: Currency format for TextBox value

<

asp:TextBox runat="server" Text='<%# Bind("Cost", "{0:c}") %>' id="txtAmount" Width="50px"></asp:TextBox>
posted @ Sunday, February 04, 2007 6:08 AM | Feedback (0)
Collection was modified; enumeration operation may not execute. Why?

You can't modify a collection while iterating over it, so try this instead.

Where items is IList<T>, item is an Object T, and you want to remove based on the item's ItemID:

if (items != null)
            {
                for (int j = items.Count - 1; j >= 0; j--)
                {
                    if (items[j].ItemID == item.ItemID)
                    {
                        items.Remove(items[j]);
                    }
                }
            }

posted @ Saturday, February 03, 2007 12:50 PM | Feedback (4)
IIS 7, Vista, and Visual Studio 2005

A couple of points:

- if you go into IIS 7 Manager, try to make changes like changing the default documents, and it gives you an “Access Denied” message, it means your web.config is read-only.  For some reason, every time you try to make changes, it apparently tries to open the web.config file (even if it doesn't do anything to it), and if it is read-only, it fails.  Even if you are running as administrator.

- to debug, you have to run VS 2005 as administrator, you need to enable Windows Authentication, and you sometimes (not clear when exactly) need to run under the Classic .NET Application pool.  The latter is due to the fact that the debugger apparently tries to attach to IIS before it is properly authenticated, which is slated to be fixed in the next Service Pack for VS 2005.

posted @ Saturday, February 03, 2007 12:48 PM | Feedback (0)