MATLAB DATABASE TOOLBOX RELEASE NOTES Guide de l'utilisateur Page 570

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 684
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 569
1 2 ... 565 566 567 568 569 570 571 572 573 574 575 ... 683 684

Commentaires sur ces manuels

Pas de commentaire