photo_cs数据类型为varchar
我想判断photo_cs值为<NULL>时就更新数据
这是我目前用的代码:
if(rs("photo_cs")="") Then
这段代码当清除<NULL>时能更新数据,列表为<NULL>时则不能更新。
if(rs("photo_cs")=null) Then 
if rs("photo_cs")=null or rs("photo_cs")="" then
if rs("photo_cs")=null Then
这样也试过了还是当列表为<NULL>时则不能更新。
请教大家!!

解决方案 »

  1.   


    --sql
    update tb set col= case when photo_cs is null then 'value' end
      

  2.   

    update tb set col = 'value' where photo_cs is null update tb set col = 'value' where photo_cs is not null 
      

  3.   

    c#里面判断数据库里的空值是用 DBNull.Value,参考一下?
      

  4.   

    vbs里面 判断null 应该是 is null 吧
      

  5.   

    if isnull(rs("photo_cs"))=true Then 
      

  6.   

    也许是我说的不全,将全的代码附上(谢谢上面朋友的回复,但测试通不过,还是显示“您已上传过图片了”)
    特请朋友们再次帮忙看看(另+10分)
    '更新数据库
    If (loveb>=abs(cspicup_num)) Then
    '读取数据库
    set rs = server.CreateObject("adodb.recordset")
    rs.open "select * from xt_main where username='"&username&"'",conn,1,1
    if(rs("photo_cs")="") Then conn.execute"update xt_main set pic_count=pic_count+1,photo_cs='"&picname&"' where username='"&username&"'"'更新主表相册数量
    conn.execute"update xt_main set loveb=loveb"&cspicup_num&" where username='"&username&"'"
    call msg("上传成功!")
    else
    call msg("您已上传过图片了")
    End If
    Else
    call msg("你的金币不足"&abs(cspicup_num)&",无法上传相片!\n\n请充值!","-1")
    End If
    set file=nothing
    set upload=nothing
      

  7.   

    if IsNull(rs("photo_cs")) then