Determine Disk Size of Tables

To see the disk size of database tables in MSSQL: 12345678910111213141516171819202122SELECT     t.NAME AS TableName,     p.rows AS RowCounts,     SUM(a.total_pages) * 8 AS TotalSpaceKB,     …

Parse Simple XML C#

123456789101112131415string s @="<?xml version=""1.0"" encoding=""utf-8"" ?><Parent><Plate>ABC123</Plate></Parent>"; XmlDocument x = new XmlDocument(); x.LoadXml(s); XmlNode rootnode = x["Parent"]; if ((rootnode != null) && (rootnode.HasChildNodes)) {      XmlNodeList nodes = rootnode.ChildNodes;   …

VS2005 Build Warning “libbmt.pdb was not found”

Build Error in Visual Studio 2005: 123LIBCMT.lib(gshandler.obj) : warning LNK4099: PDB ‘libbmt.pdb’ was not found with  ‘C:\Program Files\Microsoft Visual Studio 8\VC\ce\lib\ARMV4I\LIBCMT.lib’ or at ‘c:\Source\AIMS Ticketer 4\Release\libbmt.pdb’; linking object as if …

Sort Array by Date C#

Sort an array of objects by date Given the class below: 1234567891011121314    public class MyClass     {         public int id;         …

Draw Shapes C#

In C# you can draw a shape on any control. For example: 12345System.Drawing.SolidBrush b = new System.Drawing.SolidBrush(Color.Blue); System.Drawing.Graphics g = System.Drawing.Graphics.FromHwnd(control.Handle); float width = 50; float height = 25; g.FillRectangle(b, …

Generate Random Numbers C#

Generate a random integer in C# 123456789private static readonly Random random = new Random(); private static readonly object lock_random = new object(); public static int GetRandomNumber(int min, int max) { …

Serialization C#

Various serialization functions 123456789101112131415public static string SerializeObject(object obj) {     if (obj == null) { return string.Empty; }     System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());     string s …