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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strings lost in a series of replace statements

Status
Not open for further replies.

guineamation

Programmer
Jan 29, 2002
58
IL
I have a series of "replace" statements inserting strings stored in variables inside a long "Insert" sentence into a database. The first two statements insert the values correctly after replacing the characters, the rest insert nothing, as if lost the values.
 
can you give some of the details in regards to the replace functions and the coding involved? We have nothing really to on with what you provided.

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924

onpnt2.gif
 
Below is the function, and this line: replace (solution3, "'", "''")&"','"&_, seems to not insert anything though there's text in the form that sends a string to it.

c.execute "insert into phd values('"&_
request.form("id")&"','"&_
request.form("model")&"','"&_
request.form("problemdate")&"','"&_
replace (problem, "'", "''")&"','"&_
request.form("prosuby")&"','"&_
request.form("solution1date")&"','"&_
replace (solution1, "'", "''")&"','"&_
request.form("sol1suby")&"','"&_
request.form("solution2yesno")&"','"&_
request.form("solution2date")&"','"&_
replace (solution2, "'", "''")&"','"&_
request.form("sol2suby")&"','"&_
request.form("solution3yesno")&"','"&_
request.form("solution3date")&"','"&_
replace (solution3, "'", "''")&"','"&_
request.form("sol3suby")&"','"&_
request.form("solution4yesno")&"','"&_
request.form("solution4date")&"','"&_
request.form("solution4")&"','"&_
request.form("sol4suby")&"','"&_
request.form("solution5yesno")&"','"&_
request.form("solution5date")&"','"&_
request.form("solution5")&"','"&_
request.form("sol5suby")&"')"
 
replacing the values with hard coded values it works fine.
you need to do some debugging to track down this error really. don't use the request collection in the sql statement and declare variables for now. then debug them by reponse.writing them out. your not getting values somewhere and I can't see why the replace function would be causing it. unless I'm missing something simple.
eg: debug
Response.Write "Debug --> " & replace (problem, "'", "''")

also test the SQL for proper formatting. a missing '," may do it without a error.
Check the first couple FAQ in this forum for debugging procedures and help on syntax problems also

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924

onpnt2.gif
 
Thanks. The strange thing is that it works perfectly fine once or twice and then the variables seem to loose their content. After I wrote my previous mail, i've tested it again and even the variables that functioned before suddenly lost the strings. what could cause a variable to lose its content.
 
reassigning the variable can cause it .. check for conditionals that might define or change the variable contents

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top