Skip to main content

Posts

C# Drive Info

foreach (DriveInfo DI in DriveInfo.GetDrives()) Console.WriteLine( ( DI.IsReady ? (DI.VolumeLabel.Length == 0 ? "Drive Type: " + DI.DriveType.ToString() : "Volume Label: " + DI.VolumeLabel) : "Not Ready : " + DI.DriveType.ToString() ) + // " (" + DI.Name.Replace("\\", "") + ")" " (" + DI.Name + ")" + Environment.NewLine ); Code highlighting compliments of http://markup.su/highlighter/ Another options is  http://hilite.me/

Aliases and selecting from a select

Rarely do you need select from a select statement. Occasionally this pops up with complex PIVOTs and UNPIVOTs. The tip when doing this is (in MSSQL) is the "table" select statement needs to be aliased. For example, the following statement will not work: SELECT * FROM ( SELECT * FROM blah )  However, the following statement will work: SELECT * FROM ( SELECT * FROM blah ) x