title: Save a DataTable into a database table
body: <p>I am generating a Data Table from my application and I would like to save the whole Data Table into one database table.</p>
  
  <pre><code>DataTable ds = //add the info from the queue in the application
  </code></pre>
  
  <p>The DataTable is getting generated but What to do next.Show me some syntax.I dont really need the select statement there either, i just want to insert all the info from the DataTable into  already created db table(update the table).
  I will use the ODBC connection to access the MYSQL database</p>
  
  <p>i want to update the data into the database through dataset directly   </p>
  
  <pre><code>public void update(DataTable ds)
  {
    try
    {  
      lock (myLockHolder)
      {
        X1 = 1;
        OdbcConnection con = 
        new OdbcConnection(LocalConnection.GetLocalConnetionString());
        OdbcCommand cmd;
        OdbcDataAdapter da;
        DataSet ds1=new DataSet();
        string query = "";
        query = "update parameter" + Environment.NewLine;
        query += "set paramvalue=paramvalue,date_logged1=date_logged1," 
          + Environment.NewLine;
        query += "  Quality=Quality,date_logged=date_logged" 
          + Environment.NewLine;
        query += " where itemID=itemID";
        cmd = new OdbcCommand(query, con);
        da = new OdbcDataAdapter(cmd);
        ds1=new DataSet();
        ds1.Tables.Add(ds);
        da.Update(ds1);                   
  
      }
    }
    catch { }
    finally { }
  }
  </code></pre>
  
  <p>It will be used like this method catch this exception
  "Update unable to find TableMapping['Table'] or DataTable 'Table'."</p>