User`s guide

fastinsert
7-135
The last row contains the inserted data.
Close the cursor and database connection.
close(curs)
close(conn)
Insert and Commit Data
Connect to the data source dbtoolboxdemo. This data source identifies a Microsoft
Access database. This database contains the table inventoryTable with these columns:
productNumber
Quantity
Price
inventoryDate
conn = database('dbtoolboxdemo','admin','admin');
Alternatively, you can use the native ODBC interface for an ODBC connection. For
details, see database.
Set the AutoCommit flag to off.
set(conn,'AutoCommit','off')
Insert the cell array data into the inventoryTable with column names colnames.
data = {157,358,740.00,datestr(now,'yyyy-mm-dd HH:MM:SS')};
colnames = {'productNumber','Quantity','Price','inventoryDate'};
tablename = 'inventoryTable';
fastinsert(conn,tablename,colnames,data)
Commit the inserted data.
commit(conn)
Alternatively, commit the data using an SQL commit statement with the exec function.
curs = exec(conn,'commit');
Close the cursor and database connection.