dim aaa
aaa=request.form("myCustomerName")
if isnull(aaa) or aaa='' then
conn.execute "insert into customer(CustomerDate) values(null)"
else
conn.execute "insert into customer(CustomerDate) values('"&aaa&"')"
end if

解决方案 »

  1.   

    --要插入NULL值,必须显式的指定为NULL.--上面的判断aaa是否为null,不知道ASP中是否如此判断.如果不是.楼主自行更下一下.
      

  2.   

    当数据库字段设置为时间型时,如果文本框或参数是没值,则会存储‘1999-1-1’
    所以要判断参数是否空,如果是空则存储null
    例如:
    dim aaa
    aaa=request.form("myCustomerName")
    if aaa="" then
    conn.execute "insert into customer(CustomerDate) values('null')"else
    conn.execute "insert into customer(CustomerDate) values('"&aaa&"')"
    end if
    end if
      

  3.   

    取消默认值。myCustomerName default '1900-1-1'   ??用 zjcxc(邹建)  的试试!