Click here to Skip to main content
15,896,207 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Add-in for MS Outlook Pin
el_barri25-Sep-08 22:50
el_barri25-Sep-08 22:50 
QuestionEmbedding controls in Excel Pin
frogstomp25-Jan-06 0:13
frogstomp25-Jan-06 0:13 
QuestionHow to create a visual studio'ish prop ctrl? Pin
ioctl5124-Jan-06 2:55
ioctl5124-Jan-06 2:55 
QuestionATL COM with IIS6 Pin
MaX B.24-Jan-06 0:15
MaX B.24-Jan-06 0:15 
AnswerRe: ATL COM with IIS6 Pin
Michael Dunn24-Jan-06 7:23
sitebuilderMichael Dunn24-Jan-06 7:23 
GeneralRe: ATL COM with IIS6 Pin
MaX B.24-Jan-06 21:55
MaX B.24-Jan-06 21:55 
GeneralRe: ATL COM with IIS6 Pin
Igor Vigdorchik27-Jan-06 16:17
Igor Vigdorchik27-Jan-06 16:17 
QuestionCManualAccessor - No rows if using properties Pin
Guybrush23-Jan-06 9:05
Guybrush23-Jan-06 9:05 
Hello all, I have already posted this in the SQL board, but I didn't get any answer. I thought that perhaps this section would be more appropriate for this request. In any case, this is just to say that I am not spamming Smile | :) ...
I have been looking everywhere for a solution to this, but I couldn't find it.
I am trying to access a (generic) database using OLEDB Consumer Templates (of which I have little experience) in a WTL project (VC 2003, WTL 7.5).
Ok, the problem is that when I open a CCommand object passing a DBPropSet structure I get no rows in return.

Let me try to explain with the code..

With the following code everything works fine. I get columns and rows correctly (I removed a lot of stuff such as error handling, to simplify). The code it’s more or less the same used in the MSDN sample DBViewer:

<code>
CCommand<CManualAccessor> oCmd;
oCmd.Open(m_session, sSQL, NULL, &nRows, DBGUID_DEFAULT, FALSE)

if (oCmd.m_spRowset == NULL)
{
//ERROR STUFF
}

if (oCmd.GetColumnInfo(&ulColumns, &pColumnInfo, &pStrings) != S_OK)
ThrowOleDBError(oCmd.m_spRowset, IID_IColumnsInfo);
struct MYBIND* pBind = new MYBIND[ulColumns];

oCmd.CreateAccessor(ulColumns, &pBind[0], sizeof(MYBIND)*ulColumns);
for (ULONG l = 0; l < ulColumns; l++)
oCmd.AddBindEntry(l + 1, DBTYPE_STR, sizeof(TCHAR)*255, &pBind[l].szValue, NULL, &pBind[l].dwStatus);

oCmd.Bind();

ULONG ulFields = oCmd.GetColumnCount();

while(oCmd.MoveNext() == S_OK)
{
for (ULONG j = 1; j <= ulFields; j++)
{
lpszString = pBind[j-1].szValue;
// PRINTING STUFF
}
}
</code>

Now, if I add properties to the command using this:

<code>
CDBPropSet pset( DBPROPSET_ROWSET );
pset.AddProperty(DBPROP_IRowsetView, true);
pset.AddProperty(DBPROP_IRowsetScroll, true);
pset.AddProperty(DBPROP_IRowsetChange, true);
pset.AddProperty(DBPROP_UPDATABILITY,
DBPROPVAL_UP_INSERT | DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE);
pset.AddProperty( DBPROP_CANFETCHBACKWARDS, true, DBPROPOPTIONS_OPTIONAL );
pset.AddProperty( DBPROP_CANSCROLLBACKWARDS, true, DBPROPOPTIONS_OPTIONAL );

/*…*/

oCmd.Open(m_session, sSQL, &pset, &nRows, DBGUID_DEFAULT, FALSE, 1)

/*…*/
</code>

I get the columns shifted right (like if there is an empty column before all the others), and no records.
The m_spRowset member however it’s not null, as I check for it after the call to Open()

Can you please help me out, or at least tell me why this happens?

Thank you very much!

Guybrush Threepwood Smile | :)
AnswerRe: CManualAccessor - No rows if using properties Pin
Guybrush25-Jan-06 7:04
Guybrush25-Jan-06 7:04 
QuestionICopyHook Pin
ragavan23-Jan-06 3:00
ragavan23-Jan-06 3:00 
QuestionTransparent Static control ATL Pin
Anilkumar K V22-Jan-06 22:26
Anilkumar K V22-Jan-06 22:26 
AnswerRe: Transparent Static control ATL Pin
Stephen Hewitt22-Jan-06 23:17
Stephen Hewitt22-Jan-06 23:17 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 0:00
Anilkumar K V23-Jan-06 0:00 
GeneralRe: Transparent Static control ATL Pin
Stephen Hewitt23-Jan-06 0:10
Stephen Hewitt23-Jan-06 0:10 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 0:52
Anilkumar K V23-Jan-06 0:52 
GeneralRe: Transparent Static control ATL Pin
Stephen Hewitt23-Jan-06 1:36
Stephen Hewitt23-Jan-06 1:36 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 1:50
Anilkumar K V23-Jan-06 1:50 
GeneralRe: Transparent Static control ATL Pin
Stephen Hewitt23-Jan-06 1:58
Stephen Hewitt23-Jan-06 1:58 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 16:13
Anilkumar K V23-Jan-06 16:13 
GeneralRe: Transparent Static control ATL Pin
Stephen Hewitt23-Jan-06 16:17
Stephen Hewitt23-Jan-06 16:17 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 16:43
Anilkumar K V23-Jan-06 16:43 
GeneralRe: Transparent Static control ATL Pin
Stephen Hewitt23-Jan-06 17:07
Stephen Hewitt23-Jan-06 17:07 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 18:29
Anilkumar K V23-Jan-06 18:29 
GeneralRe: Transparent Static control ATL Pin
Stephen Hewitt23-Jan-06 19:07
Stephen Hewitt23-Jan-06 19:07 
GeneralRe: Transparent Static control ATL Pin
Anilkumar K V23-Jan-06 19:53
Anilkumar K V23-Jan-06 19:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.