PC Review


Reply
Thread Tools Rate Thread

Re: Disconnected data

 
 
Martin Schmid
Guest
Posts: n/a
 
      25th Aug 2003
At this point, I just have a ADO::Recordset... (my code is below... prety
basic). I am just creating a rowset, and populating, then outputting... it
works.

However, say I want to sort on the '0' field or the '1' field, i..e. "F1" or
"F2"... how do I create the view to do this? I.e.,. where I have the printf
statement below, I'd like to have it sort by the F2 column...
Also... I will eventually need to 'JOIN' two such recordsets together... is
this going to be possible with a view?

Thanks for your help!
MS


// TODO: Implement the command
ADO::_RecordsetPtr oRset;
oRset.CreateInstance(__uuidof(ADO::Recordset));
oRset->PutCursorLocation(ADO::adUseClient);
oRset->PutRefActiveConnection(NULL);
oRset->PutRefSource(NULL);
ADO::FieldsPtr pFlds = oRset->GetFields();
pFlds->Append(L"F1",ADO::adInteger,0,ADO::adFldUpdatable);
pFlds->Append(L"F2",ADO::adBSTR ,0,ADO::adFldUpdatable);

oRset->Open(vtMissing,vtMissing,ADO::adOpenStatic,ADO::adLockBatchOptimistic
,ADO::adCmdUnspecified);


// autocad specific code to populate rowset
AcDbDatabase *pCurDb;
Acad::ErrorStatus es;
AcDbLayerTable* pLT;
AcDbLayerTableIterator *pLTI;
AcDbLayerTableRecord* pLTR;
AcCmColor color;
char* name;

pCurDb=acdbHostApplicationServices()->workingDatabase();
es=pCurDb->getLayerTable(pLT,AcDb::kForRead);

pLT->newIterator(pLTI);

for(;!pLTI->done();pLTI->step())
{

pLTI->getRecord(pLTR,AcDb::kForRead);
color=pLTR->color();
es=pLTR->getName(name);

oRset->AddNew(vtMissing,vtMissing);
oRset->PutCollect((short)0,(long)color.colorIndex());
oRset->PutCollect((short)1,(BSTR)name);
oRset->Update();

if(name)
free(name);

pLTR->close();
}


if(pLTI)
delete pLTI;
pLT->close();
// end autocad specific code


oRset->MoveFirst();

for(int rowNum=0; !oRset->adoEOF;oRset->MoveNext(),rowNum++)
{
int v1 = oRset->GetCollect((short)0).lVal;
int v2 = oRset->GetCollect((short)1).lVal;
//int v3 = oRset->GetCollect((short)2).lVal;
acutPrintf("\nFrom row %3d: %5d %s",rowNum,v1,v2/*,v2,v3*/);
}
oRset->Close();
oRset.Release();


--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE
"Tap" <(E-Mail Removed)> wrote in message
news:002f01c36b30$b1c86b50$(E-Mail Removed)...
> Martin,
>
> Create a view from your dataset and then you can sort it
> on any column.
>
> Thanks,
>
> Tap
>
> >-----Original Message-----
> >Am trying to model some data, and it is not comming from

> a datasource that I
> >can connect to... I have to read the data, and create my

> rowset... When I
> >have this table of data, is it possible to query this

> data.. i.e. to sort
> >(ORDER BY) a specific column, or do I need a connection

> to do that? I want
> >to avoid having to connect to a data source to dump in my

> data just to be
> >able to sort on it...
> >
> >Any help is more than welcome..
> >
> >--
> >Thanks,
> >Martin Schmid, EIT, CCSA, MCDBA, MCSE
> >
> >
> >.
> >



 
Reply With Quote
 
 
 
 
Tap
Guest
Posts: n/a
 
      25th Aug 2003
Martin,

Does VC++ have an interface IComparer available ? I am not
at all experienced in C++, sorry, i couldn't help you.

Thanks,

Tap

>-----Original Message-----
>At this point, I just have a ADO::Recordset... (my code

is below... prety
>basic). I am just creating a rowset, and populating,

then outputting... it
>works.
>
>However, say I want to sort on the '0' field or the '1'

field, i..e. "F1" or
>"F2"... how do I create the view to do this? I.e.,.

where I have the printf
>statement below, I'd like to have it sort by the F2

column...
>Also... I will eventually need to 'JOIN' two such

recordsets together... is
>this going to be possible with a view?
>
>Thanks for your help!
>MS
>
>
> // TODO: Implement the command
> ADO::_RecordsetPtr oRset;
> oRset.CreateInstance(__uuidof(ADO::Recordset));
> oRset->PutCursorLocation(ADO::adUseClient);
> oRset->PutRefActiveConnection(NULL);
> oRset->PutRefSource(NULL);
> ADO::FieldsPtr pFlds = oRset->GetFields();
> pFlds->Append

(L"F1",ADO::adInteger,0,ADO::adFldUpdatable);
> pFlds->Append(L"F2",ADO::adBSTR ,0,ADO::adFldUpdatable);
>
>oRset->Open

(vtMissing,vtMissing,ADO::adOpenStatic,ADO::adLockBatchOpti
mistic
>,ADO::adCmdUnspecified);
>
>
>// autocad specific code to populate rowset
> AcDbDatabase *pCurDb;
> Acad::ErrorStatus es;
> AcDbLayerTable* pLT;
> AcDbLayerTableIterator *pLTI;
> AcDbLayerTableRecord* pLTR;
> AcCmColor color;
> char* name;
>
> pCurDb=acdbHostApplicationServices()->workingDatabase();
> es=pCurDb->getLayerTable(pLT,AcDb::kForRead);
>
> pLT->newIterator(pLTI);
>
> for(;!pLTI->done();pLTI->step())
> {
>
> pLTI->getRecord(pLTR,AcDb::kForRead);
> color=pLTR->color();
> es=pLTR->getName(name);
>
> oRset->AddNew(vtMissing,vtMissing);
> oRset->PutCollect((short)0,(long)color.colorIndex());
> oRset->PutCollect((short)1,(BSTR)name);
> oRset->Update();
>
> if(name)
> free(name);
>
> pLTR->close();
> }
>
>
> if(pLTI)
> delete pLTI;
> pLT->close();
>// end autocad specific code
>
>
> oRset->MoveFirst();
>
> for(int rowNum=0; !oRset->adoEOF;oRset->MoveNext

(),rowNum++)
> {
> int v1 = oRset->GetCollect((short)0).lVal;
> int v2 = oRset->GetCollect((short)1).lVal;
> //int v3 = oRset->GetCollect((short)2).lVal;
> acutPrintf("\nFrom row %3d: %5d %

s",rowNum,v1,v2/*,v2,v3*/);
> }
> oRset->Close();
> oRset.Release();
>
>
>--
>Thanks,
>Martin Schmid, EIT, CCSA, MCDBA, MCSE
>"Tap" <(E-Mail Removed)> wrote in message
>news:002f01c36b30$b1c86b50$(E-Mail Removed)...
>> Martin,
>>
>> Create a view from your dataset and then you can sort it
>> on any column.
>>
>> Thanks,
>>
>> Tap
>>
>> >-----Original Message-----
>> >Am trying to model some data, and it is not comming

from
>> a datasource that I
>> >can connect to... I have to read the data, and create

my
>> rowset... When I
>> >have this table of data, is it possible to query this

>> data.. i.e. to sort
>> >(ORDER BY) a specific column, or do I need a connection

>> to do that? I want
>> >to avoid having to connect to a data source to dump in

my
>> data just to be
>> >able to sort on it...
>> >
>> >Any help is more than welcome..
>> >
>> >--
>> >Thanks,
>> >Martin Schmid, EIT, CCSA, MCDBA, MCSE
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
paging with disconnected data Paul Wilson Microsoft VB .NET 0 1st Jul 2004 05:49 AM
Populating disconnected ADODB.Recordset with System.Data.DataTable data. elcc1958@yahoo.com Microsoft ADO .NET 4 31st May 2004 03:31 PM
Populating disconnected ADODB.Recordset with System.Data.DataTable data. elcc1958@yahoo.com Microsoft Dot NET 0 11th May 2004 04:43 PM
Re: Disconnected data Martin Schmid Microsoft ADO .NET 0 25th Aug 2003 08:15 PM
Disconnected data model Alex Microsoft ADO .NET 3 22nd Aug 2003 08:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:04 PM.