pigeonbr
asked on
using toupper() with m_pSet-> ODBC, VC++4.0
In this code, I'm doing a search...taking 5 member variables that are pointed to by the m_pSet-> pointer, then putting them into a CString variable, to then compare what was entered in a search string edit box. It might not be the best way to go, but it works...VC++ 4.0 doesn't have find functions in it. My problem is, I want to take the CString data in the fields and the CString data entered as search criteria in the search edit box, and convert them both to upper before doing a search, because the data could be in either case. I tried using the toupper() function, but I'm having a problem because I need to take a CString variable as my source. Can you help me out? Any other way of doing this? Again I'm using Microsoft VC++ ver4.0. Thanks!
Here is my code, excluding any conversion attempts. Got any suggestions? I want to start conversion after I attribute the m_pSet-> pointers to CString variables.
void CPieces3CLRView::OnGoCheck Box()
{
//Transfer find edit box string to variable
UpdateData(TRUE);
//Move to the first record
m_pSet->MoveFirst();
Nrec=0; //number of records set to zero before count.
//***************
//Count number of records in recordset
CPieces3CLRSet rsPieces3CLRSet(NULL);
rsPieces3CLRSet.Open( );
while(!rsPieces3CLRSet.IsE OF())
{
rsPieces3CLRSet.MoveNext() ;
//Nrec is number of records; external variable
//seen to whole file
Nrec+=1;
}
rsPieces3CLRSet.Close();
//***************
//Index is external; seen by whole file.
for(Index=1;Index<Nrec;Ind ex++)
{
//line 100***Put first field data into a //string variable
//This is where i must convert the variables to uppercase
CString strMarque =m_pSet->m_MARQUE;
CString strModele = m_pSet->m_MODELE;
CString strPiece = m_pSet->m_PIECE;
CString strDescription = m_pSet->m_DESC;
CString strTiroir = m_pSet->m_TIROIR;
//Compare string variable with edit box data //variable
if(strMarque == m_SearchEditBox)
{
//Display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
if(strModele == m_SearchEditBox)
{
//display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
if(strPiece == m_SearchEditBox)
{
//display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
if(strDescription == m_SearchEditBox)
{
//display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
m_pSet->MoveNext();
}
m_DerniereRechercheEditBox = m_SearchEditBox;
m_SearchEditBox= "";
m_ctlSearchEditBox.SetRead Only(TRUE) ;
m_GoCheckBox = FALSE;
UpdateData(FALSE);
return;
}
Here is my code, excluding any conversion attempts. Got any suggestions? I want to start conversion after I attribute the m_pSet-> pointers to CString variables.
void CPieces3CLRView::OnGoCheck
{
//Transfer find edit box string to variable
UpdateData(TRUE);
//Move to the first record
m_pSet->MoveFirst();
Nrec=0; //number of records set to zero before count.
//***************
//Count number of records in recordset
CPieces3CLRSet rsPieces3CLRSet(NULL);
rsPieces3CLRSet.Open( );
while(!rsPieces3CLRSet.IsE
{
rsPieces3CLRSet.MoveNext()
//Nrec is number of records; external variable
//seen to whole file
Nrec+=1;
}
rsPieces3CLRSet.Close();
//***************
//Index is external; seen by whole file.
for(Index=1;Index<Nrec;Ind
{
//line 100***Put first field data into a //string variable
//This is where i must convert the variables to uppercase
CString strMarque =m_pSet->m_MARQUE;
CString strModele = m_pSet->m_MODELE;
CString strPiece = m_pSet->m_PIECE;
CString strDescription = m_pSet->m_DESC;
CString strTiroir = m_pSet->m_TIROIR;
//Compare string variable with edit box data //variable
if(strMarque == m_SearchEditBox)
{
//Display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
if(strModele == m_SearchEditBox)
{
//display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
if(strPiece == m_SearchEditBox)
{
//display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
if(strDescription == m_SearchEditBox)
{
//display current record
UpdateData(FALSE);
MessageBeep((WORD)-1);
break;
}
m_pSet->MoveNext();
}
m_DerniereRechercheEditBox
m_SearchEditBox= "";
m_ctlSearchEditBox.SetRead
m_GoCheckBox = FALSE;
UpdateData(FALSE);
return;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, pigeonbr, this may solve the problem