Click here to Skip to main content
15,885,985 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionBest way to update a view after opening a file? Pin
cwbenson31-May-06 6:21
cwbenson31-May-06 6:21 
AnswerRe: Best way to update a view after opening a file? Pin
Chris Losinger31-May-06 6:34
professionalChris Losinger31-May-06 6:34 
AnswerRe: Best way to update a view after opening a file? Pin
Zac Howland31-May-06 7:19
Zac Howland31-May-06 7:19 
QuestionClient - Server modern Pin
021225331-May-06 6:02
021225331-May-06 6:02 
QuestionDifference between WS_POPUP and WS_CHILD? Pin
jayart31-May-06 5:59
jayart31-May-06 5:59 
AnswerRe: Difference between WS_POPUP and WS_CHILD? [modified] Pin
David Crow31-May-06 6:03
David Crow31-May-06 6:03 
GeneralRe: Difference between WS_POPUP and WS_CHILD? Pin
jayart31-May-06 6:15
jayart31-May-06 6:15 
QuestionProblem retrieving fields from a DB using CRecordset object Pin
Cyber Friend31-May-06 5:40
Cyber Friend31-May-06 5:40 
Hi,
I am retrieving fields from an MS-Acces database but getting problem.
CRecrodset object is opened successfully using :

bool isOpened = rs.Open( CRecordset::forwardOnly,strSqlQuery);

And this statement is also working:

short nFields = rs.GetODBCFieldCount( );// this is returning 1 , OK

But problem is here:
while( !rs.IsEOF( ) )
{
sprintf(tmp,"rs recieved %d record",cnt++);
DisplayMsg(tmp);
for( short index = 0; index < nFields; index++ )
{
rs.GetFieldValue( index, varValue );
strResult = *(varValue.m_pstring);
}
rs.MoveNext( );
}

The control never enters in this loop.

Can anyone suggest wats happening here.

here is complete code:

strSqlQuery = queryDBData->GetSqlQuery()+ strDigits;
strConnectionString = queryDBData->GetConnectionString();
try
{
objDB.OpenEx( _T(strConnectionString),CDatabase::openReadOnly | CDatabase::noOdbcDialog );
}
catch(CDBException* dbExcep)
{
isSucceeded = false;
}

CRecordset rs(&objDB); // db is database object open above;
bool isOpened = rs.Open( CRecordset::forwardOnly,strSqlQuery);
if(isOpened)
{
CDBVariant varValue;
short nFields = rs.GetODBCFieldCount( );
sprintf(tmp,"nFields %d found in dbquery ",nFields);
DisplayMsg(tmp);

while( !rs.IsEOF( ) )
{
for( short index = 0; index < nFields; index++ )
{
rs.GetFieldValue( index, varValue );
strResult = *(varValue.m_pstring);

}
rs.MoveNext( );
}
isSucceeded = true;
}
else
isSucceeded = false;

Thanx in advance.

Cyber Friend
QuestionRe: Problem retrieving fields from a DB using CRecordset object Pin
David Crow31-May-06 5:48
David Crow31-May-06 5:48 
AnswerRe: Problem retrieving fields from a DB using CRecordset object Pin
Cyber Friend31-May-06 5:57
Cyber Friend31-May-06 5:57 
GeneralRe: Problem retrieving fields from a DB using CRecordset object Pin
David Crow31-May-06 6:01
David Crow31-May-06 6:01 
GeneralRe: Problem retrieving fields from a DB using CRecordset object Pin
Cyber Friend31-May-06 23:11
Cyber Friend31-May-06 23:11 
AnswerRe: Problem retrieving fields from a DB using CRecordset object Pin
Cyber Friend31-May-06 23:21
Cyber Friend31-May-06 23:21 
GeneralRe: Problem retrieving fields from a DB using CRecordset object Pin
Cyber Friend1-Jun-06 0:59
Cyber Friend1-Jun-06 0:59 
GeneralRe: Problem retrieving fields from a DB using CRecordset object Pin
David Crow1-Jun-06 2:54
David Crow1-Jun-06 2:54 
QuestionModeless Dialogs? or Distroy Dialogs? Pin
aei_totten31-May-06 4:47
aei_totten31-May-06 4:47 
AnswerRe: Modeless Dialogs? or Distroy Dialogs? Pin
David Crow31-May-06 5:06
David Crow31-May-06 5:06 
GeneralRe: Modeless Dialogs? or Distroy Dialogs? Pin
aei_totten31-May-06 5:28
aei_totten31-May-06 5:28 
GeneralRe: Modeless Dialogs? or Distroy Dialogs? Pin
David Crow31-May-06 5:52
David Crow31-May-06 5:52 
QuestionRegister a TLB file? Pin
Ista31-May-06 4:33
Ista31-May-06 4:33 
AnswerRe: Register a TLB file? Pin
Sarath C31-May-06 4:40
Sarath C31-May-06 4:40 
AnswerRe: Register a TLB file? Pin
James R. Twine31-May-06 4:44
James R. Twine31-May-06 4:44 
AnswerRe: Register a TLB file? Pin
Roger Stoltz31-May-06 5:07
Roger Stoltz31-May-06 5:07 
GeneralRe: Register a TLB file? Pin
Ista31-May-06 5:33
Ista31-May-06 5:33 
GeneralRe: Register a TLB file? Pin
Roger Stoltz31-May-06 6:25
Roger Stoltz31-May-06 6:25 

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.