Re: delimiters, sql, joins, AHHH!

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: John (noway_at_amIgivingitouthere.com)
Date: 02/09/05


Date: Wed, 09 Feb 2005 15:34:52 GMT

I'm doing this but I still can't get the recordset to match what is being
edited. I'm just not seeing it??

<%
   Set rsGigPlace = Server.CreateObject("ADODB.Recordset")
   gigPlaceSQL = "SELECT * FROM places ORDER BY placeName ASC;"
   rsGigPlace.CursorType = 3
   rsGigPlace.Open gigPlaceSQL, gigsCon

   Response.write _
   "<select name='location'>"
   While Not rsGigPlace.EOF
   Response.write _
   "<option value='" & rsGigPlace("placeName") & "'"
   If Replace(rsGigPlace("placeName"),"'","''") =
Replace(rsGigEdit("gigPlace"),"'","''") Then Response.write "selected" End
If
   Response.write _
   ">" & rsGigPlace("placeName") & "</option>"
   rsGigPlace.MoveNext
   Wend
   rsGigPlace.Close
   Set rsGigPlace = nothing
   Response.write "</select>"
   %>

(rsGigEdit is from another recordset still open)

the html being produced....
<td>
   <select name='location'><option value='Benefit Concert'>Benefit
Concert</option><option value='Fat Moe's'>Fat Moe's</option><option
value='Froggy's'>Froggy's</option><option value='George Eastman
House'>George Eastman House</option><option
value='Georgio's'>Georgio's</option><option value='TBA'>TBA</option><option
value='The Panorama'>The Panorama</option></select>
   </td>

> 2. If it's a character/text field, then you must supply string data by
> delimiting the data either with single or double quotes. If the data
> contains literal quotes, you must escape them by doubling them. This means
> that if you use single quotes (apostrophes) for your string delimiters,
and
> the data contains an apostrophe, then you must replace the apostrophe with
> two apostrophes, like this:
> Update tbl set textfield = 'O''Malley'
> In Access, you can use double quotes for your delimiters, so this will
work
> as well:
> Update tbl set textfield = "O'Malley"
> Note: you don't have to escape the apostrophe in O'Malley when you use
> double quotes as the delimiter. However, you will need to escape the
double
> quotes when assigning this statement to a variable:
> sSQL = "Update tbl set textfield = ""O'Malley"""
> So most people will use the single quotes and escape the apostrophe:
> sName = "O'Malley"
> sSQL = "Update tbl set textfield = '" & Replace(sName,"'","''") & "'"
> response.write sSQL



Relevant Pages

  • Re: delimiters, sql, joins, AHHH!
    ... To decide whether or not to delimit the data, look at the datatype of the ... means you MUST NOT delimit the data by putting quotes around it. ... the data contains an apostrophe, then you must replace the apostrophe with ... you don't have to escape the apostrophe in O'Malley when you use ...
    (microsoft.public.inetserver.asp.general)
  • Re: what can i do if i want to include "<" or ">" in xml document.
    ... Sometimes it becomes necessary to escape the quotes and the apostrophe ... Another character to escape almost always is the ampersand character ...
    (microsoft.public.dotnet.xml)
  • Re: How to code an Insert query
    ... Won't this insert double quotes around the value being ... What he is doing is creating a string that will be passed to the ... delimiters in the string you create. ... Msgbox strQuery ...
    (microsoft.public.access.queries)
  • Re: RegExp DoubleQuote
    ... and recieved an error that the quotes don't match. ... Notice that you officially need to escape the as well when you put them in a tag. ... not work and I recieve an error about it being malformed. ... Jesse Houwing ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RegExp DoubleQuote
    ... I just stopped looking at it in frustration and left it without the double quotes. ... As to why you need to escape the " in this fashion. ... needs to be escaped according to the rules of the HTML specs. ... Jesse Houwing ...
    (microsoft.public.dotnet.languages.csharp)