473,770 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving long text field to Access - Syntax Issue Problem

The quote below is part of the information i want to save to a MS Access
database - or update, as the case may be.

The original database was built a long time ago, and looking at the code for
add/update on the original site-it does not compensate for odd syntax like
the quotes. Problem i am hitting now is syntax issue in the SQL when I go to
save/update. The syntax present causes failures every time.

User said she had no problems adding product before now - but i cannot spot
any code that avoids the issues of odd punctuation when i go to create the
SQL.

---"
It presents strategies for including humor and a positive attitude into the
lives of healthcare workers.
............... ............... ............... ............... ............... ..
............... ............... ... Click ''Buy Me'' below to purchase &
download immediately (PDF version). To buy the HARD COPY or DISK versions,
Click ''Ordering Information'' above & download an Order Form for the US or
Canada.
............... ............... ............... ............... ............... ..
............... .............
---"

Any help appreciated.

D
Jul 19 '05 #1
5 2736
> the quotes. Problem i am hitting now is syntax issue in the SQL when I go
to
save/update. The syntax present causes failures every time.


We can't offer much assistance unless you SHOW US that part.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
The field "Descriptio n" contains the issues...

sql = "update tblProduct set" _
& " Name = '" & InserviceName & "'," _
& " Description = '" & InserviceDescri ption & "'," _
& " EMailID = '" & InserviceEmailI D & "'," _
& " DiscID = '" & InserviceDiscID & "'," _
& " PaperID = '" & InservicePaperI D & "'," _
& " EMailPrice = '" & InserviceEmailP rice & "'," _
& " DiscPrice = '" & InserviceDiscPr ice & "'," _
& " PaperPrice = '" & InservicePaperP rice & "'" _
& " where Id = " & InserviceID & ""
set rs = oConn.Execute(s ql)

The problem is not with the SQL Statement - the problem is with the information saved in it. It is taking the single quotes on the String drawn from the Access database and acting as though it were syntax inside the SQL...

QUOTE of part of the String to be saved to field "Descriptio n"--->
Click ''Buy Me'' below to purchase &
download immediately (PDF version). To buy the HARD COPY or DISK versions,
Click ''Ordering Information'' above & download an Order Form for the US or
Canada.

<--- END QUOTE

I am looking for a way to save the String above as just a block of info - not as a string with quotations - these are 2 single quotes in a row btw

D
"Aaron Bertrand [MVP]" <aa***@TRASHasp faq.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
the quotes. Problem i am hitting now is syntax issue in the SQL when I go

to
save/update. The syntax present causes failures every time.


We can't offer much assistance unless you SHOW US that part.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #3
> It is taking the single quotes on the String

VFAQ.
http://www.aspfaq.com/2035
these are 2 single quotes in a row btw


That wasn't clear initially.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #4
Thanks for that link.

Just noticed a very odd... oddity. When I am drawing the info from the
database, the data is putting it into the Text field as if it were Single
Quotes, Even though the original Data was a double quote (''). To make this
clear - if I save the string (''save this'') It gets placed into the
database as (''save this''), but when I populate the Text field (for an easy
edit) on the ASP page - the text field populates like this ('save this')
which means that when I go to save this again, it messes with the SQL. The
..replace will work, it is just a very odd way for the text box to populate -
interpreting the ('') as ('). I never knew it did that.

D

"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:O5******** ******@TK2MSFTN GP10.phx.gbl...
It is taking the single quotes on the String


VFAQ.
http://www.aspfaq.com/2035
these are 2 single quotes in a row btw


That wasn't clear initially.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #5
When you do the replace, ' becomes two of them '' (not to be confused with a
double quote, ").

This replacement is passed this way to the database. The reason we do this
at all is so that the database understands which single quotes delimit the
string, and which single quotes are embedded within it. When it finds two
'' embedded within a string, it treats the first as an escape character, but
only one of them ends up in the database.

Make sense? The textarea isn't doing anything funny... go look at the data
in the database after the insert, and you will see only one ' ...

Always "encode" the data on the way in. Presentation is a different story.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Drifter" <loreseeker_pri me@hotmail*remo vethis*.com> wrote in message
news:c0******** **@nntp-stjh-01-01.rogers.nf.ne t...
Thanks for that link.

Just noticed a very odd... oddity. When I am drawing the info from the
database, the data is putting it into the Text field as if it were Single
Quotes, Even though the original Data was a double quote (''). To make this clear - if I save the string (''save this'') It gets placed into the
database as (''save this''), but when I populate the Text field (for an easy edit) on the ASP page - the text field populates like this ('save this')
which means that when I go to save this again, it messes with the SQL. The
.replace will work, it is just a very odd way for the text box to populate - interpreting the ('') as ('). I never knew it did that.

D

"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:O5******** ******@TK2MSFTN GP10.phx.gbl...
It is taking the single quotes on the String


VFAQ.
http://www.aspfaq.com/2035
these are 2 single quotes in a row btw


That wasn't clear initially.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2490
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process I've hit a snag. How do I resolve multiple external references? The transform method on a stylesheet only takes one resolver, not an array Stephen
6
6160
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but my mappings between named colors, HEX values and the Long Integer values used in Access are not jibbing. Anyone have a nice list laying around? Danny J Lesandrini dlesandrini@hotmail.com
8
25403
by: Jerry | last post by:
I have an off-the-shelf app that uses an Access database as its backend. One of the tables contains a field with an "OLE Object" datatype. I'm writing some reports against this database, and I believe this field contains data I need. When I view the table in datasheet view, all I can see in this field is the string "Long binary data". So, I've got the problem of needing to extract data from this field, but I don't know what format...
4
3302
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any errors. After reading the ole object from db, I saved it to C: as file1.bmp and displayed on the web. But it can not be displayed. After I manually sent the file to wordpad, it shows
9
2530
by: Fish Womper | last post by:
I am at best a part time developer of Access databases. I use Access 2.0, as this is all my employer has on its computers. Even so, to use this ancient version requires a fairly convoluted installation procedure on each PC on which it is used. I am self-taught from the help files that come with Access 2.0 and from painful experience. I've never attended any type of training course on how to develop databases in Access. I have no idea...
2
3164
by: JohnR | last post by:
When creating an msAccess db within the Access UI itself the fields that are text are NOT padded with blanks. For example, if I have a 10 char field and put in "HI" and then when I come back to the field and click my mouse on it the cursor is just after the "I" in "HI"... that is, no blanks were added to the field. However, when I create an MDB database programatically in VB.Net using ADOX and create the tables using SQL stmts (ie:...
18
3801
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having trouble. I have tried keeping some of the fields bound and when I use the save button it has been saving as 2 different records. This is unacceptable. This is what I have, can anyone help me out with this?
3
2561
by: Andy_Khosravi | last post by:
I'm having a problem with an entry form on one of my applications. It would appear that the save action is sometimes not working, and is generating no error when it fails. I'm hoping one of you may have some insight into what is causing the problem. I'll describe only the general outline since the actual code is several pages long. 1. Entry form opened in Data Entry mode 2. Global variable SaveRec set to False on form load.
4
6808
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form allows the employee to enter their UserID and select "Login" or "Logout" and then click a submit. When the submit button is clicked, I want the application to dum the NT Userename, UserID, status (Login or Logout) and a date/time stamp into an MS Access...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.