User`s guide

7 Functions — Alphabetical List
7-128
Price
inventoryDate
conn = database('dbtoolboxdemo','admin','admin');
Alternatively, you can use the native ODBC interface for an ODBC connection. For
details, see database.
Display the data in the inventoryTable table before insertion.
curs = exec(conn,'select * from inventoryTable');
curs = fetch(curs);
curs.Data
ans =
...
[11] [ 567] [ 0] '2012-09-11 00:30...'
[12] [ 1278] [ 0] '2010-10-29 18:17...'
[13] [ 1700] [14.5000] '2009-05-24 10:58...'
Assign the data for insertion to the cell array data. The data is:
productNumber is 7777
Quantity is 100
Price is 50.00
inventoryDate is the date of the current moment
data = {7777,100,50.00,datestr(now,'yyyy-mm-dd HH:MM:SS')};
Create a cell array containing these column names: productNumber, Quantity, Price,
inventoryDate.
tablename = 'inventoryTable';
colnames = {'productNumber','Quantity','Price','inventoryDate'};
Insert the data into the inventoryTable.
fastinsert(conn,tablename,colnames,data)
Display the data in the inventoryTable table after insertion.
curs = exec(conn,'select * from inventoryTable');