Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Apostrophes in strings
 New Topic  Topic Locked
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 13 February 2002 :  19:43:03  Show Profile  Send ruirib a Yahoo! Message
TerryG,

It didn't take that much time, really. I had everything done in my own Web site, so it just a question of a couple of minor changes here and there to test my own ideas on this issue. Don't worry about it. I just like to help and I'm not disappointed by your choice.
One should choose the best solution for each problem. When you provide help to someone you're just providing another choice to be added to the panoplia of choices for the "helpee" (sorry for the expression ) to choose from.

So, don't feel bad about your choice and I assure you that it didn't take that much work .

To finalize, answering your question. With an ASP script you just generate code to generate a page. Whether that page contains HTML or Javascript or VbScript or whatever it makes no difference. That was my point all along and that's what I tried to certify myself of. So, yes I would think you could use response.write to write the code into a onClick=FunctionName().





Edited by - ruirib on 13 February 2002 19:58:35
Go to Top of Page

Steve D.
Average Member

USA
640 Posts

Posted - 19 February 2002 :  16:04:24  Show Profile  Visit Steve D.'s Homepage  Send Steve D. a Yahoo! Message
I'm having a similar problem, but it is when I'm storing a string in to the database that contains an apostrophe, I'm getting the following error.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''It's All Swing ')'.

/test_add_class_student.asp, line 110

To test it out go to http://www.stevedandrebecca.com/test_registration.asp

----------------------------------------
Badges? We don't need no stinking badges
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 19 February 2002 :  18:00:11  Show Profile  Send ruirib a Yahoo! Message
quote:

I'm having a similar problem, but it is when I'm storing a string in to the database that contains an apostrophe, I'm getting the following error.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''It's All Swing ')'.

/test_add_class_student.asp, line 110

To test it out go to http://www.stevedandrebecca.com/test_registration.asp

----------------------------------------
Badges? We don't need no stinking badges



Well that's a new one for me. Storing a string has never been a problem. Do you want to publish the code you are using to do that?

Go to Top of Page

xMANIGHTx
Junior Member

Italy
191 Posts

Posted - 20 February 2002 :  08:49:20  Show Profile  Visit xMANIGHTx's Homepage
Steve, whene you store a string in the DB using dynamic SQL (not stored procs) you have to replace ' with ''.. and also you should replace % with ''%'' if I don't get wrong.
By the way, when you're building your SQL string (INSERT or UPDATE) just do this: strToInsert = Replace(strToInsert,"'",'')

TerryG use: onClick="function('something I\'ll put here')" That's the correnct syntax if you put the \' inside. So don't invert " with ' that's all

Distractly yours... manight@audiopro.it
Go to Top of Page

Steve D.
Average Member

USA
640 Posts

Posted - 20 February 2002 :  10:21:48  Show Profile  Visit Steve D.'s Homepage  Send Steve D. a Yahoo! Message
quote:

Steve, whene you store a string in the DB using dynamic SQL (not stored procs) you have to replace ' with ''.. and also you should replace % with ''%'' if I don't get wrong.
By the way, when you're building your SQL string (INSERT or UPDATE) just do this: strToInsert = Replace(strToInsert,"'",'')



Didn't know about the %.

I've got it to work, but now when I retrieve the value it's appears as it''s

So what I've done is done another replace when the value is retrieved.

or is

strToInsert = Replace(strToInsert,"'",'')

the same as

strToInsert = Replace(strToInsert,"'","''")


----------------------------------------
Badges? We don't need no stinking badges
Go to Top of Page

xMANIGHTx
Junior Member

Italy
191 Posts

Posted - 20 February 2002 :  14:20:01  Show Profile  Visit xMANIGHTx's Homepage
Maybe it was my fault in displying chars.
I'll make duoble apex in red "
And apostrophe in black '

strToInsert = Replace(strToInsert,"'","''")

This way it MUST store it correctly in the DB and when you retrieve it with a select you don't need any additional coding you'll get back the string in the correct format in your rsTemp("STRING").

If you are using stored procedures and pass the string as a parameter you shouldn't do any replace at all, beacause the string is passed between variables.

Hope this may help somehow

Distractly yours... manight@audiopro.it
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.38 seconds. Powered By: Snitz Forums 2000 Version 3.4.07