public override DataSet Clone()
        {
            ProductDS cln = ((ProductDS)(base.Clone()));

            cln.InitVars();
            return(cln);
        }
        private void cmdSample9_Click(object sender, System.EventArgs e)
        {
            // SqlConnection that will be used to execute the sql commands
            SqlConnection connection = null;

            // DataSet that will hold the returned results
            ProductDS productDS = new ProductDS();

            try
            {
                try
                {
                    connection = GetConnection(txtConnectionString.Text);
                }
                catch
                {
                    MessageBox.Show("The connection with the database can´t be established", "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Call FillDataset static method of SqlHelper class that fills a Dataset
                // We pass in database connection string, command type, stored procedure name and categoryID SqlParameter
                // that has a value of "1"
                SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "getProductsByCategory", productDS, new string[] { productDS.Products.TableName }, new SqlParameter("@CategoryID", 1));

                //Modify a existing product
                productDS.Products[0].ProductName = "Modified product";

                //Apply changes in the data source
                SqlHelper.ExecuteDatasetTypedParams(connection, "updateProduct", productDS.Products[0]);

                txtResults.Text = "The product " + productDS.Products[0].ProductID + " has been modified. Now, its name is " + productDS.Products[0].ProductName;
            }
            catch (DBConcurrencyException)
            {
                MessageBox.Show("A concurrency error has ocurred while trying to update the data source", "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                string errMessage = "";
                for (Exception tempException = ex; tempException != null; tempException = tempException.InnerException)
                {
                    errMessage += tempException.Message + Environment.NewLine + Environment.NewLine;
                }

                MessageBox.Show(string.Format("There are some problems while trying to use the Data Access Application block, please check the following error messages: {0}"
                                              + Environment.NewLine + "This test requires some modifications to the Northwind database. Please make sure the database has been initialized using the SetUpDataBase.bat database script, or from the  Install Quickstart option on the Start menu.", errMessage),
                                "Application error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
            }
        }