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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 684
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 564
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.
Przeglądanie stron 564
1 2 ... 560 561 562 563 564 565 566 567 568 569 570 ... 683 684

Komentarze do niniejszej Instrukcji

Brak uwag