예제 #1
0
        public void Update(DataSet dataSet)
        {
            string        insertSql    = @"INSERT Customers (CustomerID, CompanyName) VALUES (@CustomerId, @CompanyName)";
            IDbParameters insertParams = CreateDbParameters();

            insertParams.Add("CustomerId", DbType.String, 0, "CustomerId");   //.Value = "NewID";
            insertParams.Add("CompanyName", DbType.String, 0, "CompanyName"); //.Value = "New Company Name";

            string        updateSql    = @"update Customers SET Phone=@Phone where CustomerId = @CustomerId";
            IDbParameters updateParams = CreateDbParameters();

            updateParams.Add("Phone", DbType.String, 0, "Phone");           //.Value = "030-0074322"; // simple change, last digit changed from 1 to 2.
            updateParams.Add("CustomerId", DbType.String, 0, "CustomerId"); //.Value = "ALFKI";

            AdoTemplate.DataSetUpdate(dataSet, "Customers",
                                      CommandType.Text, insertSql, insertParams,
                                      CommandType.Text, updateSql, updateParams,
                                      CommandType.Text, null, null);
        }