This topic is locked

Nulls and zero-length strings in Add/Copy Page

10/24/2006 12:52:49 PM
ASPRunnerPro General questions
R
rgke author

I have a field on my SQL table which is set to a value calculated by a SQL function if a record is inserted with a null value.
In ASPRunner:

  • if I Add a new record, I want this field to be passed as null so that the SQL function triggers.

    -if I Copy a record, I want the value in the existing record to be passed into the new (copied) record.
    The problem I have is that the same page handles both Add and Copy, the only difference being that it populates the fields with the values rom the record being copied. If I include the field in the Add/Copy page, I get an error when Adding a record because the value passed is "" and not null.
    Is there any way round this?

Sergey Kornilov admin 10/24/2006

I guess you can use BeforeAdd event and the following code:

if dict("FieldName")="" then dict("FieldName")=NULL
R
rgke author 10/25/2006

I tried that, but get the following error.
[
HTTP 500.100 - Internal Server Error - ASP error

Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:

Microsoft OLE DB Provider for SQL Server (0x80040E21)

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

/commopsdocs/commonref/coral/B001t/B001WIPList_add.asp, line 632
Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Page:

POST 1891 bytes to /commopsdocs/commonref/coral/B001t/B001WIPList_add.asp
POST Data:

error '80020009'

Exception occurred.
/iisHelp/common/500-100.asp, line 223

R
rgke author 10/27/2006

Having investigated this further, I have found a work around by using SQL triggers rather than default values.