Friday, December 21, 2012

Get List Of Processes Using A DLL

here

Appending case to varchar in select

make sure you have an "else";otherwise you will append in some cases a null which will blot out the select

Thursday, December 20, 2012

Datatable Merge

if the schema is the same it will work as a union , if it has a different schema then that depends on

for e.g.


            DataTable t1 = new DataTable();
            t1.Columns.Add("key1");
            t1.Columns.Add("c1");
            t1.PrimaryKey = new[] { t1.Columns["key1"] };
            t1.Rows.Add(1, "data1");

            DataTable t2 = new DataTable();
            t2.Columns.Add("key1");
            t2.Columns.Add("c2");
            t2.PrimaryKey = new[] { t2.Columns["key1"] };
            t2.Rows.Add(1, "data2");

            t1.Merge(t2, false, MissingSchemaAction.Add);
            t1.Merge(t2);
             
            will produce
         
           while 

            DataTable t3 = t1.Clone();
            t3.Rows.Add("key2", "datablah", "datablah2"); 
            t1.Merge(t3);
            
           will produce


Implicitly Typed Arrays

Implicitly Typed Arrays


Array of Bytes to File


easy method  

   using (System.IO.FileStream _FileStream = new System.IO.FileStream(@"C:\blah\blah.csv", System.IO.FileMode.Create, System.IO.FileAccess.Write))
           {
               _FileStream.Write(bytesarray, 0, bytesarray.Length);
               _FileStream.Close();
           }

Wednesday, December 19, 2012