PutRecordset
Put data from a recordset into an Origin Matrix
BOOL PutRecordset( Object & objrs, int nMaxNumFields = -1, int nMaxNumRecords = -1, int nBufferSize = 10 )
Returns TRUE on success or FALSE on failure.
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 ; } }
Worksheet::PutRecordset
origin.h