This example shows how to use the BeforeGetRecords event handler to send the application server information it needs for incremental data fetching. Before fetching the next data packet, the client dataset packages up the key value of the last record so that the application server knows where to begin the next data packet. It also sends some application-specific information, which is stored in Memo1.
void __fastcall TForm1::ClientDataSet1BeforeGetRecords(TObject *Sender, OleVariant &OwnerData)
{
OleVariant[2] Values;
Values[0] = NULL;
if (ClientDataSet1->Active)
{
ClientDataSet *CDSClone = new ClientDataSet(Form1);
try
{
CDSClone->CloneCursor(ClientDataSet1, true);
// turn off FetchOnDemand so that the clone only
// fetches the last LOCAL record
CDSClone->FetchOnDemand = false;
CDSClone->Last();
Values[0] = CDSClone->Fields->Fields[0]->Value;
CDSClone->Close();
}
__finally
{
delete CDSClone;
}
}
Values[1] = Memo1->Lines->Text;
OwnerData = VarArrayOf(Values,1);
}
GPS location
void __fastcall TForm1::ClientDataSet1BeforeGetRecords(TObject *Sender, OleVariant &OwnerData)
{
OleVariant[2] Values;
Values[0] = NULL;
if (ClientDataSet1->Active)
{
ClientDataSet *CDSClone = new ClientDataSet(Form1);
try
{
CDSClone->CloneCursor(ClientDataSet1, true);
// turn off FetchOnDemand so that the clone only
// fetches the last LOCAL record
CDSClone->FetchOnDemand = false;
CDSClone->Last();
Values[0] = CDSClone->Fields->Fields[0]->Value;
CDSClone->Close();
}
__finally
{
delete CDSClone;
}
}
Values[1] = Memo1->Lines->Text;
OwnerData = VarArrayOf(Values,1);
}
Kenya Affordable Safaris |
No comments:
Post a Comment