MATLAB DATABASE TOOLBOX RELEASE NOTES Podręcznik Użytkownika Strona 598

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 684
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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)
Przeglądanie stron 597
1 2 ... 593 594 595 596 597 598 599 600 601 602 603 ... 683 684

Komentarze do niniejszej Instrukcji

Brak uwag