Posts
1147
Comments
890
Trackbacks
1
August 2005 Blog Posts
T-SQL: How do I get only the date?

Getdate() returns the date and the time.  What if you only want the date?

Well, you can't, at least not as a 'date-only' datatype, but you can get a varchar these ways:

select convert(varchar,getdate(),101) -- change the 101 to get different formatting

or

select convert(varchar,datepart(yy,getdate())) + '-' + convert(varchar,datepart(mm,getdate())) + '-' + convert(varchar,datepart(dd,getdate()))

posted @ Thursday, August 25, 2005 9:14 AM | Feedback (0)
Layers vs. Tiers

This is a really good write-up on the difference between layers and tiers and why, in general, multiple layers are good, while multiple tiers are bad.

http://dotnetjunkies.com/WebLog/sstewart/archive/2005/04/06/62689.aspx

posted @ Wednesday, August 24, 2005 4:27 PM | Feedback (1)
.NET: Introducing Comega

http://www.xml.com/lpt/a/2005/01/12/comega.html

posted @ Tuesday, August 23, 2005 4:24 PM | Feedback (1)
.NET: Dynamic DataGrid Paging and Sorting Using A DataReader

This is a great article:

http://www.dotnetjunkies.com/HowTo/3F9C7FED-BFDB-49CC-BAF9-442079430EB2.dcik

posted @ Tuesday, August 23, 2005 4:17 PM | Feedback (1)
.NET - Set default connection for a database project

Right click the project and choose “set default reference.”  You can choose an existing reference or create a new one.

posted @ Monday, August 22, 2005 3:24 PM | Feedback (1)
How do I get NUnit to see the app.config I need to test a Windows Form?

Thanks to Ryan Scott for this:

The following post-build event will relocate and rename a configuration file for use by NUnit

copy "$(ProjectDir)App.config" "$(TargetDir)$(TargetFileName).config"

To test from debugger:

Set test project as startup project.  Debug mode = program, start application --> NUnit-GUI, Working Directory -- > project bin directory, command line arguments = dll name.

posted @ Monday, August 22, 2005 1:51 PM | Feedback (1)
Test-Driven Development in .NET

A very quick and concise overview:

http://www.peterprovost.org/articles/Test_Driven_Development_In_DotNet.aspx

posted @ Monday, August 22, 2005 12:42 PM | Feedback (1)
Mobile Agents (Objects)

This is a good primer on an interesting concept:

http://www.codeproject.com/gen/design/MobileAgents.asp

posted @ Friday, August 19, 2005 4:15 PM | Feedback (1)
Extreme Programming Flow Chart

You can click on a section and see specific details:

http://www.extremeprogramming.org/map/project.html

posted @ Friday, August 19, 2005 3:13 PM | Feedback (1)
.NET : Refactoring article

It uses a migration example from VB6 to VB.NET to explain a lot of the things you can do with refactoring to improve your code (with a snippet also about the new generics feature in .NET 2.0):

http://www.codeproject.com/vb/net/Refactoring_elixir.asp

posted @ Friday, August 19, 2005 10:05 AM | Feedback (1)
How to monitor SQL Server 2000 blocking

http://support.microsoft.com/default.aspx?scid=kb;en-us;271509

posted @ Thursday, August 18, 2005 1:08 PM | Feedback (1)
.NET: Why can't I see my panel?

When you use multiple panels in a form and want to hide/show specific ones in certain circumstances in the same place, be sure that when you added the panels to the form, you actually added them to the form and not to each other.  It's easy to drag and drop one panel into another panel itself and not the base form, and so you can run into trouble.

posted @ Monday, August 15, 2005 9:10 AM | Feedback (1)
.NET: Use of unassigned local variable in try-catch-finally

This is just an example, but you should get the idea:

You have a SqlDataReader.   You use ExecuteReader inside a try block like this:

SqlDataReader oDataReader =  oCommand.ExecuteReader()  ;

You want to ensure it closes, so you say SqlDataReader.Close() in the finally block.  But the compiler gives the “Use of unassigned local variable” error. 

To avoid this, you need to make sure that you declare the DataReader outside of the try block itself, either within whatever method you have the try-catch-block in, or as a memeber of the class itself.

posted @ Friday, August 12, 2005 9:19 AM | Feedback (1)
.NET: Why can't I see my Windows Form menu?

Either you named it 'Menu' or you didn't set the Form's menu property.

posted @ Thursday, August 11, 2005 3:42 PM | Feedback (1)
.NET: Displaying a form within a form

public void ShowForm(Form f)

{

f.TopLevel = false;

f.FormBorderStyle = FormBorderStyle.None;

f.Dock = DockStyle.Fill;

thisContainerPanel.Controls.Add(f);

f.Show();

this.Text = f.Text;

}

posted @ Thursday, August 11, 2005 1:25 PM | Feedback (1)
.NET: Runtime DataBinding for the Microsoft Spreadsheet Control for Windows Forms

I'm using version 11, but I assume the syntax is similar for previous versions.

if oExcel is your Spreadsheet Control, then you can databind by setting the ConnectionString and CommandText of the ActiveSheet, like this:

oExcel.ActiveSheet.ConnectionString = ConnectionString;
oExcel.ActiveSheet.CommandText = "myStoredProcName";

If you aren't sure what to use as a ConnectionString, right-click on the control at design-time, choose commands and options, and run through the wizard to choose your data source (you can then delete the settings if you don't want there to be any default load).

posted @ Thursday, August 11, 2005 12:51 PM | Feedback (1)
T-SQL: SET vs. SELECT when assigning to variables

Both work.  Which is better?  Arguably, there is a slight bit of 'taste', but the recommended way is to use SET.  Why?

  • It is ANSI compliant, while using SELECT is not.
  • It makes code cleaner (this is where 'taste' might come in...)
  • SET will assign null if no value is returned, while SELECT won't (so if use a variable in a loop, SELECT will keep the old value).
  • SET will throw an error if multiple values are returned, SELECT won't.
posted @ Tuesday, August 09, 2005 1:37 PM | Feedback (1)
Useful SQL Script Site

For SQL Server 2000:

http://www.extremeexperts.com/SQL/Scripts/default.aspx

posted @ Monday, August 08, 2005 10:47 AM | Feedback (1)
Sending Ctrl-Alt-Del to an XP Remote Desktop

Ctrl-Alt-End

posted @ Monday, August 08, 2005 10:08 AM | Feedback (1)
Logical Tier Design

An interesting read:

http://www.codeproject.com/gen/design/TierPressure.asp

posted @ Monday, August 08, 2005 7:11 AM | Feedback (1)