[thelist] Re: Adjusting strings for SQL

Casey Crookston casey at thecrookstons.com
Mon Jul 14 10:11:59 CDT 2003


Okay,



I actually solved the first problem that I asked about (see below.) But it
turns out that was not the root of the problem.  I understand that, when
using an HTML form, you must use double quotes in the value statement if you
don't want data after an apostrophe to be dropped.  But, when you are
wrapping all HTML in response.write, how is this done?



This does not work, and causes data to be lost:



response.write "<input type='hidden' name='block' value=' "&block&" '>



The actual rendered html is: value='user enetered text'



This DOES works:



<%......

response.write "    <input type='hidden' name='block'"%> value="<%=block%>">

<%........



The actual rendered html is: value="user entered text"



But this is such an ugly and inefficient way to go about the process.  Is
there a better way?



TIA,



Casey







----- Original Message -----
From: "Casey Crookston" <casey at thecrookstons.com>
To: <thelist at lists.evolt.org>
Sent: Monday, July 14, 2003 9:48 AM
Subject: ASP: Adjusting strings for SQL


> Hello List,
>
> I'd like to know what the best practice is for adjusting a string for SQL.
> I have a text box that is being written to a memo column in Access, and
> currently it drops everything after an apostrophe. (Example: user enters
> "It's our employees that....." and only "It" is written to the db.)  I
> undersdtand, however, that an apostrophe is not the only thing that would
> cause the SQL to blow up.
>
> So, is there a built in VB function to adjust for these situations?  Or is
> there a simple (or not-so-simple) work around?
>
> TIA,
>
> Casey
>



More information about the thelist mailing list