Tips for Querying Text Columns in SSMS


There’s some really handy tips here.

Originally posted on Learning SQL Server:

SQL Server Management Studio (SSMS) is a great tool for writing and running queries. This post will provide some extra tips on querying text fields in a database table. These include:

  • Query fields with long or formatted text
  • Copying strings by dragging them from the results grid
  • T-SQL query tips for working with strings

View original 553 more words

Just learned about Json.NET

I just learned about the incredibly useful Visual Studio add-in Json.NET (or JSON.NET, not sure which is the correct way to write it). I added it to a project I was working on recently, so that I could easily parse some JSON. It’s awesome!!! I recommend adding it via NuGet. Here’s a link to James Newton-King’s page, where he describes the excellent JSON.NET he wrote.

And here’s the link to the documentation for JSON.NET.

An example of an ASP.NET app I wrote

I have been working for a number of years using various Microsoft technologies. One if ASP.NET, using what’s known as Web Forms. I decided, some years ago, to write a simple video management system, for our videos. If I were starting today, I might not write such an app, given such services like Ultraviolet, Flixster, VUDU, Netflix, etc., but still I like to have something to, well play around with and try out different ideas. So here’s the search page I wrote, for searching my database. This is the ASP.NET code:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    search media library</h2>
    <asp:SqlDataSource ID="sdsTypeOfShow" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VideoLibraryConnectionString %>" 
        SelectCommand="SELECT * FROM TypeOfShow ORDER BY ShowName">
    <asp:SqlDataSource ID="sdsImage" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VideoLibraryConnectionString %>" 
        SelectCommand="SELECT DISTINCT ImageForShow FROM TypeOfShow WHERE (ShowCode = @ShowCode)" 
            <asp:ControlParameter ControlID="ddlTypeOfShow" Name="ShowCode" 
                PropertyName="SelectedValue" Type="Int32" />
    Category to Search:
    <asp:DropDownList ID="ddlTypeOfShow" runat="server" 
        DataSourceID="sdsTypeOfShow" DataTextField="ShowName" 
        DataValueField="ShowCode" AutoPostBack="True" 
    <asp:Repeater ID="repImage" runat="server" DataSourceID="sdsImage">
            <asp:Image ImageUrl='<%# Eval("ImageForShow", "~/Images/{0}") %>' runat="server" CssClass="RightJustify" />
    (Enter at least one of the following)</h3>
    Episode name (a portion may be specified):
    <asp:TextBox ID="txtEpisodeName" runat="server" MaxLength="50" Width="394px"></asp:TextBox>
    <br />
    Synopsis (a portion may be specified):
    <asp:TextBox ID="txtSynopsis" runat="server" Width="425px"></asp:TextBox>
        <asp:SqlDataSource ID="sdsEpisodes" runat="server" 
            ConnectionString="<%$ ConnectionStrings:VideoLibraryConnectionString %>" 
            SelectCommand="spEpisodesByShowCodeAndName" SelectCommandType="StoredProcedure">
                <asp:ControlParameter ControlID="ddlTypeOfShow" DefaultValue="4" 
                    Name="ShowCode" PropertyName="SelectedValue" Type="Int16" />
                <asp:ControlParameter ControlID="txtEpisodeName" DefaultValue="" 
                    Name="EpisodeName" PropertyName="Text" Type="String" />
                <asp:ControlParameter ControlID="txtSynopsis" Name="Synopsis" 
                    PropertyName="Text" Type="String" />
        <asp:GridView ID="grdEpisodes" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
            BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
            DataKeyNames="ShowID" DataSourceID="sdsEpisodes" GridLines="Horizontal">
            <AlternatingRowStyle BackColor="#F7F7F7" />
                <asp:HyperLinkField DataNavigateUrlFields="ShowCode,ShowID" 
                    HeaderText="Click to View" Text="View">
                <ItemStyle HorizontalAlign="Center" />
                <asp:BoundField DataField="EpisodeName" HeaderText="Episode" 
                    SortExpression="EpisodeName" />
                <asp:BoundField DataField="PlayTime" HeaderText="Play Time" 
                    SortExpression="PlayTime" />
                <asp:BoundField DataField="ShowCode" HeaderText="ShowCode" 
                    SortExpression="ShowCode" Visible="False" />
                <asp:BoundField DataField="Synopsis" HeaderText="Synopsis" 
                    SortExpression="Synopsis" />
                <asp:BoundField DataField="DateLastViewed" DataFormatString="{0:d}" 
                    HeaderText="Last Viewed" SortExpression="DateLastViewed" />
                <asp:BoundField DataField="ShowID" HeaderText="ShowID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ShowID" Visible="False" />
                <asp:BoundField DataField="Rating" DataFormatString="{0:F3}" 
                    HeaderText="Our Rating" NullDisplayText="(Not yet rated)" 
                <ItemStyle HorizontalAlign="Center" />
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
            <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
            <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
            <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
            <SortedAscendingCellStyle BackColor="#F4F4FD" />
            <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
            <SortedDescendingCellStyle BackColor="#D8D8F0" />
            <SortedDescendingHeaderStyle BackColor="#3E3277" />
        <br />
    <asp:Button ID="btnSearch" runat="server" CommandName="Search" Text="Search" 
        ToolTip="Perform search" />
    <asp:Button ID="btnReset" runat="server" CommandName="Reset" Text="Reset" />

The bulk of the work is all done in the ASP.NET code, but for completeness sake, here’s the C# code behind file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Search : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

        protected void ddlTypeOfShow_SelectedIndexChanged(object sender, EventArgs e)

        protected void sdsImage_Selected(object sender, SqlDataSourceStatusEventArgs e)

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

Looks like Verizon isn’t going to upgrade HTC Trophy’s to 7.8

I’ve been using my HTC Trophy, from Verizon, for almost 2 years. It started out as Windows Phone 7, then was upgraded to Windows Phone 7.5. When word came out that Microsoft was working on a Windows Phone 8, but would upgrade WP 7.5 to 7.8, to give us some of the features of WP 8 (like more customization of the tiles on the Start screen), I was pretty excited. I waited. Weeks turned into months, with nothing happening. Finally, today I came across a link from WP Central’s website, saying that Verizon had done an “end of life” to several phones, back in January 2013, and the humble HTC Trophy was one of those axed.

Oh well, no love for the old HTC Trophy.