Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
QuestionBarcode type recognision Pin
paper6720-May-08 7:56
paper6720-May-08 7:56 
AnswerCROSS POST Pin
leckey20-May-08 7:59
leckey20-May-08 7:59 
QuestionBadImageFormatException while calling DLL in C# winx64 system? Why it gives error? Pin
sharp_k20-May-08 7:39
sharp_k20-May-08 7:39 
Questionhow to pass value of one page to another Pin
salil_k_singh20-May-08 6:21
salil_k_singh20-May-08 6:21 
AnswerRe: how to pass value of one page to another Pin
User 665820-May-08 6:43
User 665820-May-08 6:43 
AnswerRe: how to pass value of one page to another Pin
Gareth H20-May-08 7:12
Gareth H20-May-08 7:12 
QuestionDataSet merge method usage question. Pin
oscarderooij20-May-08 5:44
oscarderooij20-May-08 5:44 
AnswerRe: DataSet merge method usage question. Pin
topcatalpha20-May-08 21:27
topcatalpha20-May-08 21:27 
Hi,

Maybe you have to make some changes on my code, but i wrote a merge myself.

static class DataSetMerging
{
    public static bool ExtendedMerge(System.Data.DataSet Current, System.Data.DataSet Incoming, bool DeleteAbscent)
    {
        bool result = false;
        if(Incoming != null)
        {
            foreach(System.Data.DataTable Table in Current.Tables)
            {
                System.Data.DataTable IncomingTable = Incoming.Tables[Table.TableName];
                if(IncomingTable != null && Table.Columns.Count == IncomingTable.Columns.Count && Table.PrimaryKey.Length != 0)
                {
                    int ctr = Table.Rows.Count-1;
                    while(ctr>-1)
                    {
                        System.Data.DataRow Row = Table.Rows[ctr];
                        object[] KeyValues = new object[Table.PrimaryKey.Length];
                        System.Data.DataColumn[] PrimaryKeys = new System.Data.DataColumn[Table.PrimaryKey.Length];
                        int ctr2 = 0;
                        while(ctr2<Table.PrimaryKey.Length)
                        {
                            KeyValues[ctr2] = Row[Table.PrimaryKey[ctr2]];
                            PrimaryKeys[ctr2] = IncomingTable.Columns[Table.PrimaryKey[ctr2].ColumnName];
                            ctr2++;
                        }
                        IncomingTable.PrimaryKey = PrimaryKeys;
                        System.Data.DataRow IncomingRow = IncomingTable.Rows.Find(KeyValues);
                        if(DeleteAbscent && IncomingRow == null)
                        {
                            Table.Rows.Remove(Row);
                        }
                        else if(IncomingRow != null)
                        {
                            bool UpdateRow = false;
                            int ctr3= 0;
                            while(ctr3<Table.Columns.Count)
                            {
                                if(Row[Table.Columns[ctr3].ColumnName].ToString() != IncomingRow[Table.Columns[ctr3].ColumnName].ToString())
                                {
                                    UpdateRow = true;
                                    Row[Table.Columns[ctr3].ColumnName] = IncomingRow[Table.Columns[ctr3].ColumnName];
                                }
                                ctr3++;
                            }
                            if(UpdateRow)
                            {
                                Row.AcceptChanges();
                            }
                            IncomingTable.Rows.Remove(IncomingRow);
                        }
                        // all rows verified.. now add remaining rows.
                        ctr--; // wel eentje aftellen.
                    }
                    if(IncomingTable.Rows.Count > 0)
                        Table.Merge(IncomingTable);
                }
            }
        }
        else
        {
            result = true;
        }
        //Current.Merge(Incoming, false);
        return result;
    }
}


Greetz

Kurt C.
GeneralRe: DataSet merge method usage question. Pin
oscarderooij21-May-08 7:35
oscarderooij21-May-08 7:35 
QuestionC# Programming Challenge - By Reelix Pin
Reelix20-May-08 5:03
Reelix20-May-08 5:03 
AnswerRe: C# Programming Challenge - By Reelix [modified] Pin
originSH20-May-08 5:33
originSH20-May-08 5:33 
GeneralRe: C# Programming Challenge - By Reelix Pin
ssclaire20-May-08 6:35
ssclaire20-May-08 6:35 
GeneralRe: C# Programming Challenge - By Reelix Pin
User 665820-May-08 6:40
User 665820-May-08 6:40 
GeneralRe: C# Programming Challenge - By Reelix Pin
Guffa20-May-08 9:17
Guffa20-May-08 9:17 
GeneralRe: C# Programming Challenge - By Reelix Pin
Reelix20-May-08 9:10
Reelix20-May-08 9:10 
AnswerRe: C# Programming Challenge - By Reelix Pin
geekfromindia20-May-08 5:51
geekfromindia20-May-08 5:51 
GeneralRe: C# Programming Challenge - By Reelix Pin
Reelix20-May-08 9:05
Reelix20-May-08 9:05 
AnswerRe: C# Programming Challenge - By Reelix Pin
geekfromindia20-May-08 5:56
geekfromindia20-May-08 5:56 
AnswerRe: C# Programming Challenge - By Reelix [modified] Pin
User 665820-May-08 6:09
User 665820-May-08 6:09 
GeneralRe: C# Programming Challenge - By Reelix Pin
Reelix20-May-08 9:12
Reelix20-May-08 9:12 
AnswerToo easy Pin
Guffa20-May-08 8:01
Guffa20-May-08 8:01 
GeneralRe: Too easy Pin
Reelix20-May-08 9:17
Reelix20-May-08 9:17 
GeneralRe: Too easy Pin
Guffa20-May-08 9:21
Guffa20-May-08 9:21 
GeneralRe: Too easy Pin
Reelix20-May-08 19:58
Reelix20-May-08 19:58 
GeneralRe: Too easy Pin
Guffa21-May-08 6:00
Guffa21-May-08 6:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.