MATLAB DATABASE TOOLBOX RELEASE NOTES Guide de l'utilisateur Page 677

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 684
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 676
update
7-247
ans =
[ 1] [ 1700] [14.5000] '2014-10-20 00:00...'
[ 2] [ 1200] [ 9.3000] '2014-10-20 00:00...'
[ 3] [ 356] [17.2000] '2014-10-20 00:00...'
...
Define a cell array for the new price of the first product.
data(1,1) = {30.00};
Define the WHERE clause for the first product.
whereclause = 'where productNumber = 1';
Update the Price column in the inventoryTable for the first product.
tablename = 'inventoryTable';
colname = {'Price'};
update(conn,tablename,colname,data,whereclause)
Display the data in the inventoryTable table after making the update.
curs = exec(conn,'select * from inventoryTable');
curs = fetch(curs);
curs.Data
ans =
[ 1] [ 1700] [ 30] '2014-10-20 00:00...'
[ 2] [ 1200] [ 9.3000] '2014-10-20 00:00...'
[ 3] [ 356] [17.2000] '2014-10-20 00:00...'
...
The first product has an updated price of 30. Though the data is updated, the change has
not committed to the database.
Roll back the update.
rollback(conn)
Display the data in the inventoryTable table after rolling back the update.
curs = exec(conn,'select * from inventoryTable');
Vue de la page 676

Commentaires sur ces manuels

Pas de commentaire