Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 27th, 2003, 07:28 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delet contents of a single cell

I am trying to delete a date entry from a form during update using a SQL string. The text says to use an "Empty Value" but never show how to code it. My code works if the field is alreay empty but it will not delete what is already in the field.

strSQL = "UPDATE ServiceRecords SET "

If Request.Form("completed") <> "" Then strSQL = strSQL & "completed = #" & CDate(Replace(Request.Form("completed"), "'", "''")) & "#, "

If Request.Form("serviceda") <> "" Then strSQL = strSQL & "serviceda = #" & CDate(Replace(Request.Form("serviceda"), "'", "''")) & "#, "

strSQL = strSQL & "client = '" & CStr(Replace(Request.Form("client"), "'", "''")) & "', " _
            & "tech = '" & CStr(Replace(Request.Form("tech"), "'", "''")) & "', " _
    ("parts"), "'", "''")) & "', " _
        & "comments = '" & CStr(Replace(Request.Form("comments"), "'", "''")) & "' " _
            & "WHERE (ID = " & iRecordId & ")"

  #2 (permalink)  
Old August 27th, 2003, 08:14 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

marmer,

Your 'if' statement only deals with the situation when the completed and serviceda variable have something in them if they are empty ("") then your code says not to not update those fields. Use an 'if else' to provide the alternative value for the fields when the form fields are blank.

Also it appears that there is some code missing before the ("parts") section of code, probably the replace and request.form.

Rod

======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a Hyperlink based on Cell Contents chatguy Excel VBA 4 October 15th, 2007 09:43 PM
Pointer to contents of another cell swood829 Excel VBA 2 June 14th, 2005 03:51 PM
How to compare cell contents with a character? danwes Excel VBA 5 June 8th, 2005 11:36 AM
ASP.Net Single Single-on with Oracle Application S guhanath Oracle 0 October 6th, 2004 05:05 AM
help with single cell output surethg Beginning PHP 1 October 5th, 2004 03:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.