std::string replace function
Posted on 2002-04-18
I'm having issues find any example code on using std::replace. I have
looked and what I'm finding doesn't make a lot of since.
std::string szMyString = "";
szMyString.append("EXEC sp_MyProc ");
Here I have a SQL statement that was passed in and I'm just wanting to save
the SQL statement off to an Audit table so we can't find when and what was
The SQL statement being passed to me is ExecMsg. What I'm needing to
do is take this var, put it in the szMyString, then replace all the single
quotes with two single quotes, so SQL don't freak out on me when I go to
Now how do I replace all the single quotes with two single quotes?
These don't seem to work.. Looking around I don't understand exacly what
is needing passed in.
szMyString.replace(1, szMyString.length(), "'", "''");
szMyString.replace(1, "'", "''");
Thanx for your time..