Unable delete the data if it has space in between

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kirubagari
    New Member
    • Jun 2007
    • 158

    Unable delete the data if it has space in between

    Hi Experts,
    If i want to delete a data ,lets say RayMond Roy the code that i developed have bugs to delete that.Without space i can able to delete without any problem.Please help

    Code:
     	 response.write "<td align=center><img border=0 src=images/delete.gif alt=Delete onmouseover=this.style.cursor='hand' onmouseout=this.style.cursor='default' onclick=getcell('d','" & rsct("ID") & "','" & rsct("VALUE") & "');>"
    
    
    if operation = "d" then
              cn.execute("delete from table where ID = " & detail) %>
    			<script languange="javascript">
    			document.operation.submit();
    		</script>	<%
    end if
  • ariful alam
    New Member
    • Jan 2011
    • 185

    #2
    you should use (') single quote in both side of variable details like
    Code:
    cn.execute("delete from table where ID = '" & detail & "'") %>
    Hope works for you. :)

    Comment

    • PsychoCoder
      Recognized Expert Contributor
      • Jul 2010
      • 465

      #3
      You dont need 's if the variable type is integer

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        As already suggested use single quotes on both the sides and trim the values before assigning to the variable if the variable is a string type. If it is a number type, you will not have any issue.

        Comment

        • kirubagari
          New Member
          • Jun 2007
          • 158

          #5
          Hi All,

          Still having issue.
          Please help.Unable delete the data.The data type is Varchar

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Use the single quotes as suggested. If you are still having a problem, you need to show us the new code.

            Comment

            Working...