MATLAB DATABASE TOOLBOX RELEASE NOTES Guía de usuario Pagina 672

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 684
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 671
7 Functions — Alphabetical List
7-242
curs.Data
ans =
[ 1] [1700] [14.5000] '2014-09-23 09:38...'
[ 2] [1200] [ 9] '2014-07-08 22:50...'
[ 3] [ 356] [ 17] '2014-05-14 07:14...'
...
Define a cell array containing the column name that you are updating called Quantity.
colnames = {'Quantity'};
Define a cell array containing the new data 2000.
data = {2000};
Update the column Quantity in the inventoryTable for the product with
productNumber equal to 1.
tablename = 'inventoryTable';
whereclause = 'where productNumber = 1';
update(conn,tablename,colnames,data,whereclause)
Fetch the data again and view the updated contents in the inventoryTable.
curs = exec(conn,'select * from inventoryTable');
curs = fetch(curs);
curs.Data
ans =
[ 1] [2000] [14.5000] '2014-09-23 09:38...'
[ 2] [1200] [ 9] '2014-07-08 22:50...'
[ 3] [ 356] [ 17] '2014-05-14 07:14...'
...
In the inventoryTable data, the product with the product number equal to 1 has an
updated quantity of 2000 units.
After finishing with the cursor object, close it.
close(curs)
Vista de pagina 671
1 2 ... 667 668 669 670 671 672 673 674 675 676 677 ... 683 684

Comentarios a estos manuales

Sin comentarios