【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.3.9.50 matrixbase::PutRecordset
Contents
Description
Put data from a recordset into an Origin Matrix
Syntax
BOOL PutRecordset( Object & objrs, int nMaxNumFields = -1, int nMaxNumRecords = -1, int nBufferSize = 10 )
Parameters
- objrs
- [input]recordset to take the data from.
- nMaxNumFields
- [input]maximum number of fields (columns) to get, or -1 to get all.
- nMaxNumRecords
- [input]maximum number of records (rows) to get, or -1 to get all.
- nBufferSize
- [input]how many rows will be read from recordset each time, this size is the value of nrows when call GetRows method inside this method.
Return
Returns TRUE on success or FALSE on failure.
Examples
EX1
void Matrixbase_PutRecordset_Ex1() { Object ocrs; try { ocrs = CreateObject("ADODB.Recordset"); } catch(int nError) { out_str("Failed to create ADODB.Recordset"); return ; } if( !ocrs ) return ; ocrs.CursorLocation = 3; string strSource = GetOriginPath(ORIGIN_PATH_SYSTEM) + "Samples\Import and Export\stars.mdb"; string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strSource; string strQuery = "select * from Telescopes"; try { ocrs.open( strQuery, strConn, 0, 1); } catch(int nError) { out_str("Failed to open database"); return ; } MatrixPage mp; mp.Create("origin"); MatrixLayer ml = mp.Layers(0); Matrix myMat(ml); try { myMat.PutRecordset(ocrs); } catch(int nError) { out_str("Failed to put data in Matrix"); return ; } }
Remark
See Also
Header to Include
origin.h