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)
 ASP beginner...help!!! Apostrophe problem
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

cube175
Starting Member

2 Posts

Posted - 30 July 2001 :  18:01:51  Show Profile
I'm having a problem inserting text into a field in an access database.

It's just a simple SQL statement

sSQL="INSERT INTO orgs (OrgName, OrgDescrip, Address1, Address2, City, State, Zip, PhoneNumber, FaxNumber, Email) " &_
"VALUES ('" & fOrgName & "','" & fOrgDescrip & "','" & fOrgAddy1 & "','" & fOrgAddy2 & "','" & fOrgCity & "','" & fOrgState & "','" & fOrgZip & "','" & fOrgPhone & "','" & fOrgFax & "','" & fOrgEMail & "');"
HraDB.Execute(sSQL)

The problem i'm having is when there is an apostrophe anywhere in the text, for instance in the description field, the page returns an error. How do I avoid this?

Edited by - cube175 on 30 July 2001 18:05:58

Deleted
deleted

4116 Posts

Posted - 30 July 2001 :  18:13:29  Show Profile
For those items which can have ' and " inside (i.e. text items) use:

fOrgName = replace (fOrgName,"'","''")
fOrgName = replace (fOrgName,"""","""""")

This is usually done after you post the form and confirm the contents.

Think Pink
Go to Top of Page

cube175
Starting Member

2 Posts

Posted - 30 July 2001 :  20:08:53  Show Profile
That did the trick, thanks!!!

Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 31 July 2001 :  15:26:41  Show Profile
quote:

That did the trick, thanks!!!





You're welcome

Think Pink
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07