I have a DataSet with only two tables in it. The first table is a list of models (of products) with default parameters (settings), and the second table is a list of modules. A module is a product based on a given model but with some parameters that have been changed. A sample DataSet in XML format could be something like this :<?xml version=1.0 encoding=utf-8 ?><Parameters>  <Model>    <IdModel>1</IdModel>    <Par1>10</Par1>    <Par2>0.5</Par2>    <Par3>15</Par3>  </Model>  <Model>    <IdModel>2</IdModel>    <Par1>20</Par1>    <Par2>0.5</Par2>    <Par3>20</Par3>  </Model>  <Module>    <IdModule>11</IdModule>    <IdModel>1</IdModel>    <Par1>11</Par1>  </Module>  <Module>    <IdModule>12</IdModule>    <IdModel>1</IdModel>    <Par3>12</Par3>  </Module>  <Module>    <IdModule>21</IdModule>    <IdModel>2</IdModel>    <Par1>21</Par1>  </Module></Parameters>What I need to do is to retrieve a module in this database and its parameters. The parameters are the default ones (those of the corresponding model) but with the personnalized ones that have been specified in the XML.I managed to retrieve such data but in a very non-efficient and non-elegant way as don't know much of SQL or Linq requests :    private static void RetrieveLaserSettings(DataSet ds, string Id)    {        //Retrieve the two tables from dataset        DataTable Models = ds.Tables[Model];        DataTable Modules = ds.Tables[Module];        //The corresponding model and module        Dictionary<string, string> model = new Dictionary<string, string>();        Dictionary<string, string> module = new Dictionary<string, string>();        //Look for the right module        DataRow[] rowsModules = Modules.Select(IdModule =  + Id);        if(rowsModules.Length > 0)        {            if(rowsModules.Length > 1)            {                Console.WriteLine(Several modules with the same ID);                return;            }            //Fill the data            DataRow rowModule = rowsModules[0];            for(int i = 0; i < rowModule.Table.Columns.Count; i++)            {                string columnName = rowModule.Table.Columns[i].ColumnName;                string colValue = rowModule.ItemArray[i].ToString();                module.Add(columnName, colValue);            }            //Look for the model            string modelId = rowModule[IdModel].ToString();            DataRow[] rowsModels = Models.Select(IdModel =  + modelId);            if(rowsModels.Length > 0)            {                if(rowsModels.Length > 1)                {                    Console.WriteLine(Several models with the same ID);                    return;                }                //Fill the data                DataRow rowModel = rowsModels[0];                                    for(int i = 0; i < rowModel.Table.Columns.Count; i++)                {                    string columnName = rowModel.Table.Columns[i].ColumnName;                    if(string.Equals(columnName, IdModel))                        continue;                    string colValue = rowModel.ItemArray[i].ToString();                    foreach(KeyValuePair<string, string> pair in module)                    {                        if(string.Equals(columnName, pair.Key.ToString()) && !string.IsNullOrEmpty(pair.Value.ToString()))                        {                            colValue = pair.Value.ToString();                        }                    }                                            model.Add(columnName, colValue);                }            }        }        //Display the result        foreach(KeyValuePair<string, string> pair in model)        {            Console.WriteLine(pair.Key.ToString() +  :  + pair.Value.ToString());        }    }Any help or suggestion is welcome !! Thanks
(More) efficient and elegant way to retrieve data from a dataset?
c#;sql;xml;linq