Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropped "\" in string using ODBC and Visual C++

Status
Not open for further replies.

siftach

Programmer
Jul 22, 2003
78
IL
I recently moved from MS Access to MySQL and discovered a small problem with strings containing "\". If I insert such string to a database using an ODBC connector with Visual C++, all the "\" are dropped. For example: "Z:\Mertel\Saturn" becomes "z:MertelSaturn".

However, if I link that table in an MS Access database and use the MS Access ODBC connector, I don't get this problem. But I don't want to use anoter layer of ODBC just to solve this problem.

How can I solve this problem *without* changing my string before insertion?
 
Nope.

The backslash disappears because that character is used by c-langage (and thus C++) as its escape character. If you need those backslashes to traverse through c, you're going to have to convert them to double-backslashes.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
I already double backslashed to get the original string, I can't go over all my SQL strings and redouble backslash them. There must be a simpler solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top