A Fabricated ADO Recordset

A disconnected recordset is a recordset which does not hold an active connection. A fabricated recordset can be viewed as a variation of a disconnected recordset. The variation in the fabricated recordset is that the connection is never established. You can use this type of ADO recordset object as a UDT.

Under normal circumstances, when the number of UDT objects you need to store increases, the complexity seek Algorithm and time fluctuates. But the fabricated recordset supports a large number of datatypes and the seek is optimized (thanks to the guys at Redmond).

Use the following code snippet to create a Fabricated recordset:

#import "C:\Program Files\Common Files\System\ado\msado15.dll"no_namespace named_guids rename("EOF" ,"adEOF")_RecordsetPtr rs;HRESULT hr = CoInitialize(NULL);try{  hr = rs.CreateInstance(__uuidof(Recordset));       rs->CursorLocation = adUseClient;       rs->Fields->Append("Empid",adBSTR,10,adFldUpdatable);       rs->Fields->Append("EmpName",adBSTR,30,adFldUpdatable);       rs->Fields->Append("EmpDept",adBSTR,30,adFldUpdatable);hr = rs->Open(vtMissing,vtMissing,adOpenDynamic,adLockOptimistic,-1);//Perform Insertrs->AddNew();rs->Fields->GetItem("Empid")->Value = OLESTR("E001");rs->Fields->GetItem("EmpName")->Value = OLESTR("Kaams");rs->Fields->GetItem("EmpName")->Value = OLESTR("DevX");//Perform Any other operations here.rs->Close();
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: