Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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 & ")"

Reply With Quote
  #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.
======================================
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:37 PM.


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