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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 684
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 569
7 Functions — Alphabetical List
7-140
Examples
Import All Data Using the Native ODBC Interface and Cursor Object
Create a connection conn using the native ODBC interface and the dbtoolboxdemo
data source.
conn = database.ODBCConnection('dbtoolboxdemo','admin','admin')
conn =
ODBCConnection with properties:
Instance: 'dbtoolboxdemo'
UserName: 'admin'
Message: []
Handle: [1x1 database.internal.ODBCConnectHandle]
TimeOut: 0
AutoCommit: 0
Type: 'ODBCConnection Object'
conn has an empty Message property, which means a successful connection.
Working with the dbtoolboxdemo data source, use fetch to import all data into the
database.ODBCCursor object, curs, and store the data in a cell array contained in the
cursor object property curs.Data.
curs = exec(conn,'select productDescription from productTable');
curs = fetch(curs)
curs =
ODBCCursor with properties:
Data: {10x1 cell}
RowLimit: 0
SQLQuery: 'select productDescription from productTable'
Message: []
Type: 'ODBCCursor Object'
Statement: [1x1 database.internal.ODBCStatementHandle]
With the native ODBC interface, curs returns an ODBCCursor Object instead of a
Database Cursor Object.
View the contents of the Data element in the cursor object.
curs.Data
Przeglądanie stron 569
1 2 ... 565 566 567 568 569 570 571 572 573 574 575 ... 683 684

Komentarze do niniejszej Instrukcji

Brak uwag