Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C
Expertise: Intermediate
Nov 24, 2003

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 Insert

rs->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();
Kamesh S
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap