Tuesday, January 30, 2018

Merge Multiple DataTable into Single DataTable C#

In this tutorial I will show you how to merge different DataTable in one DataTable.

Suppose you have 2 DataTable

DataTable 1

HcodeDescription
BH01Hierarchy 1
BH02Hierarchy 2

DataTable 2

LinesIDLineNameSequence
L01Company1
L02Group10
L03Department4


Now after merging the two datatable you want the result to be like this.

HcodeDescriptionLinesIDLineNameSequence
BH01Hierarchy 1L01Company1
BH02Hierarchy 2L02Group10
L03Department4

To accomplish this structure use the following code


void AddColumns(DataTable dt)
        {

            foreach (DataColumn dc in dt.Columns)
            {
                NewDt.Columns.Add(dc.ColumnName);
            }
        }

        DataTable Merge(DataSet ds)
        {
            int maxRows = 0;
            foreach (DataTable dt in ds.Tables)
            {
                AddColumns(dt);
                if (maxRows < dt.Rows.Count)
                    maxRows = dt.Rows.Count;
            }
            for (int i = 0; i < maxRows; i++)
            {
                DataRow drToAdd = NewDt.NewRow();
                NewDt.Rows.Add(drToAdd);
            }

            int CurrentRow = 0;

            int parentcount = 0;
            foreach (DataTable dt in ds.Tables)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    int colcount = 0;
                    foreach (DataColumn dc in dt.Columns)
                    {
                        NewDt.Rows[CurrentRow][colcount + parentcount] = dr[dc];

                        colcount++;
                    }
                    CurrentRow++;
                }
                CurrentRow = 0;
                parentcount += dt.Columns.Count;
            }
            return NewDt;
        }

Just call the Merge method and pass your DataSet.

The Above code will work on multiple DataTable, so if you have more than 2 Datatable it will just work fine

I hope it was informative for you and I would like to Thank you for reading.

Sunday, January 21, 2018

Samsung Galaxy S7 Edge ROOT (Exynos ONLY)

You can easily Root your S7 Edge (Exynos) by following my instructions! Running Android version 7 (Nougat)

DISCLAIMER: I AM NOT RESPONSIBLE IF YOU DAMAGE OR BRICK YOUR PHONE. THIS THREAD IS CLEARLY FOR THE: SAMSUNG GALAX7 S7 EDGE (EXYNOS) SM-G935*. THIS IS THE METHOD OF HOW I ROOTED MY S7 EDGE AND I WANTED TO SHARE THIS METHOD WITH YOU.


WARNING: BEFORE STARTING TO ROOT YOUR PHONE MAKE SURE YOU HAVE AT LEAST 50% BATTERY. IF THE BATTERY RUNS OUT WHILE ROOTING YOUR PHONE, YOU WILL END UP DAMAGING YOUR PHONE

To Root your S7 Edge you will need:

1. Your Galaxy S7 Edge(Exynos SM-G935*).

2. Your Laptop/PC

3. Files that will be given below.

Instructions:

1. Make sure you Enable USB Debugging and OEM Unlock From Developer setting. (To Enable Developer options you need to: Open settings>Scroll down and Press "About phone">Then you need to press "Build number" 6-7 times Until you see a Box saying that you Enabled Developer Options. Now go back and above the "About phone is where Developer Options are located)

2. Then you need to Download Odin and TWRP:


Download ODIN

Download TWRP

3. After you downloaded all files on your Laptop/PC, you need to unzip Odin3_v3.10.6.zip anywhere you want.

4. Then you need to Enter Download mode by Turning off your S7 edge and pressing Home + Vol. Down + Power button until you see The S7 Edge logo.

5. After booting to Download mode. Connect your phone to the PC and Open Odin. You should see a small box saying ID:COM and below a blue Box saying "0:[COM*]". If you don't see that then you will need to download Samsung USB Drivers

USB Drivers

6. After connecting your Phone to your Computer, Press the "AP" Button and select the TWRP Zip you downloded.

7. After selecting TWRP Press the start button and wait until the process completes. Do NOT Unplug your phone until you see the box above The COM box saying PASS with green background.

8. Then your Phone should boot into Recovery. After that boot your phone normally

NOTE: AFTER FLASHING TWRP YOUR PHONE MAY NOT READ THE INTERNAL STORAGE AND YOU WONT BE ABLE TO BOOT YOUR PHONE OR INSTALLANYTHING FROM INTERNAL STORAGE. TO FIX THAT JUST GO TO YOUR RECOVERY>WIPE>ADVANCED WIPE> TYPE YES. 

ADVANCED WIPE WILL WIPE ANYTHING FROM YOUR INTERNAL STORAGE INCLUDING: PHOTOS,VIDEOS,APPS,CONTACTS AND ANYTHING THAT IS INSIDE THE INTERNAL STORAGE

[MAKE SURE TO BACKUP EVERYTHING.]

9. After successfully booting your phone. Download the root Links:

Super SU

dm-verity and forced encryption disabler: 

10. After that, you need to move these two files you just downloaded to your External SD Card.

11. Now boot to Recovery by turning off your phone and after that press the Power button + Home Button + Vol. Up button until you see S7 Edge logo.

12. After you booted to Recovery swipe the Allow Modifications. Then you will need to Go to Install>Select Storage>Micro SD Card>Select SuperSU Zip> Add more zips>no-verity zip.

13. Then slide to Install

14. After installation completes Click "Reboot system". 

NOTE: Your phone should take 5-6 minutes to boot. Do NOT Turn your phone Off Until it boots Up.

Now your S7 Edge Should be rooted Now.

IF YOU HAVE ANY QUESTIONS ABOUT HOW TO INSTALL OR IF YOU HAVE ANY PROBLEMS INSTALLING. FEEL FREE TO PM ME. Thank's.