• November 15

    Rounding to the Nearest Ten

    Posted Under: General Programming Tags: C#

    I'm not sure if the Microsoft .NET Framework has support for rounding to the nearest ten, hundreds, thousands, etc, so I built a quick snippet of code to accomplish this. The basic algorithm is to mod the value by 10 (can be modified to handle 100, 1000, etc), then if less than the median (in this case 5), subtract that from the original value. If the mod is greater than or equal to the median, we round up by adding the DIFFERENCE between the remainder and the rounding base (10 in this case). If there is a built in function, ...

    Read More »

  • August 09

    OneNote 2007 Checklist Workaround

    Posted Under: Miscellaneous Tags: Office 2007 OneNote

    I've been wanting a checklist system for a long time to keep track of projects and To-Do lists for my programs and web projects. Unfortunately, Outlook 2007 doesn't support subtasks!I scoured the web looking for an alternative, but found nothing that I liked... Then I remembered OneNote, it's a great utility for keeping notes and ideas about projects, and I will definitely be using it to log my progress. However, it doesn't have a checklist feature either! But I found a neat little way to simulate the idea, though not perfect it does the job. All I do is add ...

    Read More »

  • March 15

    Paging Data in SQL Server 2000

    Posted Under: Tags: SQL

    Up until now I've been blowing off adding paging support to my web projects. This is very bad practice and I figured it was time to stop. Now I know enough SQL to make a SELECT command (if I have a program that can generate it for me :P) so I didn't even know where to BEGIN with this one.

    Thankfully, the knowlegable folks over at 4GuysFromRolla.com have already done the work for me and gave detailed steps in this handy tutorial that made creating the paging stored procedure a SNAP!

    Thanks to their detailed tutorial I was able to ...

    Read More »

  • February 14

    Select Query: Retrieve Fixed Number of Rows Part 2

    Posted Under: Tags: SQL

    In my last entry, I touched on a way to dynamically select a specific number of rows from a table in a SELECT SQL query. It works great if you are going to supply the value directly when you call the procedure. But what if you are using a static value that is stored in the database itself? I have a Settings table that stores Property/Value pairs, and one of those properties is the NumItems that I want to retrieve from the SELECT query!

    I could create a public shared property that will retreive the value from the database, ...

    Read More »

  • February 13

    Select Query: Retrieve Fixed Number of Rows

    Posted Under: Database Development Tags: SQL

    As I'm beginning work on my senior project, I have discovered the need to select a specific number of rows from a SELECT query in SQL Server 2000. Although the new 2005 version has the built in ability to pass a variable for the TOP clause, no such functionality exists in SQL SERVER 2000. Fortunately I found a great resource showing various ways to accomplish it. The best one in my opinion is to pass the variable into the SET ROWCOUNT command, which can take a variable as a value:

     


    CREATE PROCEDURE dbo.getFoo
    @top INT
    AS
    BEGIN
    SET ROWCOUNT ...

    Read More »

  1. 1
  2. 2
  3. Next page