am using
public int deleteProduct(int ProductID, int rowid)
{
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();
DataSet productsDataSet = new DataSet();
string sqlCommand = "Select ProductID, ProductName, CategoryID, UnitPrice, LastUpdate " +
"From Products";
DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);
string productsTable = "Products";
// Retrieve the initial data
db.LoadDataSet(dbCommand, productsDataSet, productsTable);
// Get the table that will be modified
DataTable table = productsDataSet.Tables[productsTable];
// Modify an existing product
// Establish our Insert, Delete, and Update commands
DbCommand insertCommand = null;
DbCommand deleteCommand = db.GetSqlStringCommand("delete Products where ProductID=" + ProductID);// db.GetStoredProcCommand("DeleteProduct");
table.Rows[1]["ProductID"] = ProductID;
db.AddInParameter(deleteCommand, "ProductID", DbType.Int32, "ProductID", DataRowVersion.Current);
DbCommand updateCommand = null;
// Submit the DataSet, capturing the number of rows that were affected
int rowsAffected = db.UpdateDataSet(productsDataSet, "Products", insertCommand, updateCommand, deleteCommand, UpdateBehavior.Standard);
return rowsAffected;
}
the above code am using but throughing below error how to resolve
"Update requires a valid UpdateCommand when passed DataRow collection with modified rows."