?
Solved

using toupper() with m_pSet-> ODBC, VC++4.0

Posted on 1998-12-04
2
Medium Priority
?
434 Views
Last Modified: 2008-03-03
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::OnGoCheckBox()
{
      //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.IsEOF())
      {
            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;Index++)
      {
            //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.SetReadOnly(TRUE);
      m_GoCheckBox = FALSE;      
      UpdateData(FALSE);      
      return;

      
      
}
0
Comment
Question by:pigeonbr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 400 total points
ID: 1179220
toupper only converts a single character

e.g.
char c = toupper( 'a' ) ; // c is now 'A'

use MakeUpper (member of CString) to convert a string to uppercase

CString abc = "abc" ;
abc.MakeUpper() ; // abc is now "ABC"

you can do this on any CString, e.g. if m_pSet->m_strWhatever is your string

m_pSet->m_strWhatever.MakeUpper() ;

0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1179221
Well, pigeonbr, this may solve the problem
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question