Click here to Skip to main content
16,005,038 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting the data from a CString into an LPVOID data type Pin
Nish Nishant3-May-02 5:43
sitebuilderNish Nishant3-May-02 5:43 
GeneralRe: Getting the data from a CString into an LPVOID data type Pin
Tom Archer3-May-02 5:53
Tom Archer3-May-02 5:53 
GeneralRe: Getting the data from a CString into an LPVOID data type Pin
kyledunn3-May-02 4:47
kyledunn3-May-02 4:47 
GeneralRe: Getting the data from a CString into an LPVOID data type Pin
mystro_AKA_kokie3-May-02 4:01
mystro_AKA_kokie3-May-02 4:01 
GeneralDatabase Query containing single or Double Quotes Pin
Samir Sood3-May-02 3:19
Samir Sood3-May-02 3:19 
GeneralRe: Database Query containing single or Double Quotes Pin
Nish Nishant3-May-02 4:04
sitebuilderNish Nishant3-May-02 4:04 
GeneralRe: Database Query containing single or Double Quotes Pin
3-May-02 6:44
suss3-May-02 6:44 
GeneralRe: Database Query containing single or Double Quotes Pin
Tom Archer3-May-02 6:47
Tom Archer3-May-02 6:47 
As Nish said, you need to double up on the quotes. For example, Access chokes on quotes in a string value because it uses quotes as the string delimiter. Therefore, here's a function I wrote a few years ago to do what you need. It only handles single quotes, but obviously you can easily modify it for your needs.

CString FormatValidAccessString(CString const & sStringToBeFormatted)
{
 CString sFormattedString;

 int iStringLength = sStringToBeFormatted.GetLength();
 char cChar;

 for (int i = 0; i < iStringLength; i++)
 {                               
  cChar = sStringToBeFormatted.GetAt(i);
  sFormattedString += cChar;
  if ('\'' == cChar)
  {
   sFormattedString += cChar;
  }
 }	

 return sFormattedString;		
}



Cheers,
Tom Archer
Author, Inside C#

A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
GeneralRe: Database Query containing single or Double Quotes Pin
Stefan Pedersen3-May-02 8:54
Stefan Pedersen3-May-02 8:54 
QuestionComboBox - selchange? Pin
jimNLX3-May-02 3:11
jimNLX3-May-02 3:11 
AnswerRe: ComboBox - selchange? Pin
Michael P Butler3-May-02 4:20
Michael P Butler3-May-02 4:20 
GeneralRe: ComboBox - selchange? Pin
jimNLX3-May-02 7:24
jimNLX3-May-02 7:24 
QuestionHow to set EditBox as readonly and steel have a white backgroud ? Pin
adara3-May-02 2:37
adara3-May-02 2:37 
AnswerRe: How to set EditBox as readonly and steel have a white backgroud ? Pin
Tom Archer3-May-02 3:15
Tom Archer3-May-02 3:15 
AnswerRe: How to set EditBox as readonly and steel have a white backgroud ? Pin
john john mackey3-May-02 5:58
john john mackey3-May-02 5:58 
Generalreading sectors from CD Pin
hobnob3-May-02 2:33
hobnob3-May-02 2:33 
GeneralRe: reading sectors from CD Pin
3-May-02 5:50
suss3-May-02 5:50 
GeneralQ: how to obtain message box font display property setting Pin
Gil Clark3-May-02 2:16
Gil Clark3-May-02 2:16 
GeneralRe: Q: how to obtain message box font display property setting Pin
Roger Allen3-May-02 2:58
Roger Allen3-May-02 2:58 
GeneralRe: Q: how to obtain message box font display property setting Pin
Gil Clark3-May-02 3:47
Gil Clark3-May-02 3:47 
GeneralRe: Q: how to obtain message box font display property setting Pin
Maxwell Chen3-May-02 3:05
Maxwell Chen3-May-02 3:05 
GeneralRe: Q: how to obtain message box font display property setting Pin
Gil Clark3-May-02 3:39
Gil Clark3-May-02 3:39 
GeneralRe: Q: how to obtain message box font display property setting Pin
Maxwell Chen3-May-02 3:47
Maxwell Chen3-May-02 3:47 
GeneralRe: Q: how to obtain message box font display property setting Pin
Gil Clark3-May-02 4:14
Gil Clark3-May-02 4:14 
Generali could not update my context menu item... Pin
Atilla Selem3-May-02 1:40
Atilla Selem3-May-02 1:40 

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.