Results 1 to 4 of 4

Thread: testing DbNull

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    testing DbNull

    I have a datagrid and one of the fields from the DB may return a null value. How can I test if it does?

    <ItemTemplate>
    <%# Container.DataItem ("Display_Start_Date").ToShortDateString()%>
    </ItemTemplate>

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    <ItemTemplate>
    <%# IIF(IsDBNull(Container.DataItem ("Display_Start_Date"))," - NULL - ", Container.DataItem ("Display_Start_Date").ToShortDateString())%>
    </ItemTemplate>
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    damn!

    still the same error..

    Public member 'ToShortDateString' on type 'DBNull' not found.

  4. #4

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    is this the proper syntax...

    <%# IIF(IsDBNull

    shouldn't it be something like


    <%# IIF(Is DBNull.Value

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width