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

  • 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 597
7 Functions — Alphabetical List
7-168
Select and display the data from the yearlySales table.
curs = exec(conn,'select * from yearlySales');
curs = fetch(curs);
curs.Data
ans =
Month salesTotal Revenue
--------- ---------- -------
'January' 130 1200
'Feb' 25 250
Store the column names of yearlySales in a cell array.
colnames = {'Month','salesTotal','Revenue'};
Store the data for the insert in a cell array, data. The data contains Month equal to
'March', salesTotal equal to $50, and Revenue equal to $2000.
data = {'March',50,2000};
Insert the data into yearlySales.
tablename = 'yearlySales';
insert(conn,tablename,colnames,data)
Display the data from yearlySales again.
curs = exec(conn,'select * from yearlySales');
curs = fetch(curs);
curs.Data
ans =
Month salesTotal Revenue
--------- ---------- -------
'January' 130 1200
'Feb' 25 250
'March' 50 2000
A new row appears in yearlySales with the data from data.
After finishing with the cursor object, close it.
close(curs)
Vue de la page 597
1 2 ... 593 594 595 596 597 598 599 600 601 602 603 ... 683 684

Commentaires sur ces manuels

Pas de commentaire