User`s guide

7 Functions — Alphabetical List
7-68
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 400345.00 1001.00 14.00 'Building Blocks'
2.00 400314.00 1002.00 9.00 'Painting Set'
3.00 400999.00 1009.00 17.00 'Slinky'
4.00 400339.00 1008.00 21.00 'Space Cruiser'
5.00 400455.00 1005.00 3.00 '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 400876.00 1004.00 8.00 'Sail Boat'
7.00 389123.00 1007.00 16.00 'Engine Kit'
8.00 212569.00 1001.00 5.00 'Train Set'
9.00 125970.00 1003.00 13.00 'Victorian Doll'
10.00 888652.00 1006.00 24.00 'Teddy Bear'
ans =
productNumber stockNumber supplierNumber unitCost productDescription
_____________ ___________ ______________ ________ __________________