MATLAB DATABASE TOOLBOX RELEASE NOTES Uživatelská příručka Strana 510

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 684
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 509
7 Functions — Alphabetical List
7-80
readall
Read every record in DatabaseDatastore
Syntax
data = readall(dbds)
Description
data = readall(dbds) retrieves data from the DatabaseDatastore object dbds in
the format specified using setdbprefs.
Examples
Read Every Record in a DatabaseDatastore
The default output data type of any datastore is a table. Set the database preference
for the data return format 'DataReturnFormat' to table for consistency across data
types.
setdbprefs('DataReturnFormat','table')
Create a database connection conn using the native ODBC interface with Windows
Authentication. This code assumes you are connecting to a Microsoft SQL Server
database with the data source named MS SQL Server Auth. MS SQL Server Auth
contains the table named productTable with 15 product records.
conn = database.ODBCConnection('MS SQL Server Auth','','');
Create a DatabaseDatastore object dbds using the database connection conn and
SQL query sqlquery. This SQL query retrieves all products from the product table
productTable ordered by product number.
sqlquery = ['select * from [toy_store].[dbo].[productTable] '...
'order by productNumber'];
dbds = datastore(conn,sqlquery);
Zobrazit stránku 509
1 2 ... 505 506 507 508 509 510 511 512 513 514 515 ... 683 684

Komentáře k této Příručce

Žádné komentáře