Download MATLAB DATABASE TOOLBOX RELEASE NOTES User`s guide

Transcript
7
Functions — Alphabetical List
sqlquery = ['select * from [toy_store].[dbo].[productTable] '...
'order by productNumber'];
dbds = datastore(conn,sqlquery);
Read the first five records.
read(dbds,5)
ans =
productNumber
_____________
stockNumber
___________
supplierNumber
______________
unitCost
________
productDescription
__________________
1.00
2.00
3.00
4.00
5.00
400345.00
400314.00
400999.00
400339.00
400455.00
1001.00
1002.00
1009.00
1008.00
1005.00
14.00
9.00
17.00
21.00
3.00
'Building Blocks'
'Painting Set'
'Slinky'
'Space Cruiser'
'Tin Soldier'
Determine if the DatabaseDatastore has additional data.
hasdata(dbds)
ans =
1
hasdata returns 1. There is more data to read in the cursor object of the
DatabaseDatastore object dbds.
Read the rest of the data in the DatabaseDatastore object dbds five records at a time.
while(hasdata(dbds))
read(dbds,5)
end
ans =
productNumber
_____________
stockNumber
___________
supplierNumber
______________
unitCost
________
productDescription
__________________
6.00
7.00
8.00
9.00
10.00
400876.00
389123.00
212569.00
125970.00
888652.00
1004.00
1007.00
1001.00
1003.00
1006.00
8.00
16.00
5.00
13.00
24.00
'Sail Boat'
'Engine Kit'
'Train Set'
'Victorian Doll'
'Teddy Bear'
stockNumber
___________
supplierNumber
______________
unitCost
________
productDescription
__________________
ans =
productNumber
_____________
7-68