problem on Date/Time Data Type

Discussion in 'ASP General' started by leo, Oct 24, 2005.

  1. leo

    leo Guest

    Hello there

    Im having trouble in storing blank or space value on a variable wich data
    type is Date/Time, if i make a statement like this

    Field Data Type
    CPARCAVEDate Date/Time

    strCPARCAVEDate = rstFEVV.fields("CPARCAVEDate").value

    if strCPARCAVEDate = "" then
    counter = counter + 1
    end if

    The value doesnt increment. Do you guys have an idea how to recognize a no
    value

    Thanks
    Leo
     
    leo, Oct 24, 2005
    #1
    1. Advertising

  2. leo

    Steven Burn Guest

    IsNull()
    IsEmpty()
    Len()

    ASP isn't like VB, so most of the time (depending on what you are doing of
    course), you can switch datatype checks while you go ...

    e.g;

    sSomeDate = "10/05/2005"
    Response.Write "sSomeDate: " & sSomeDate & "<br><br>"
    Response.Write "Len: " & Len(sSomeDate) & "<br>"
    Response.Write "IsNull: " & IsNull(sSomeDate) & "<br>"
    Response.Write "IsEmpty: " & IsEmpty(sSomeDate) & "<br>"

    http://mysteryfcm.plus.com/misc/pdatatype.asp


    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "leo" <> wrote in message
    news:...
    > Hello there
    >
    > Im having trouble in storing blank or space value on a variable wich data
    > type is Date/Time, if i make a statement like this
    >
    > Field Data Type
    > CPARCAVEDate Date/Time
    >
    > strCPARCAVEDate = rstFEVV.fields("CPARCAVEDate").value
    >
    > if strCPARCAVEDate = "" then
    > counter = counter + 1
    > end if
    >
    > The value doesnt increment. Do you guys have an idea how to recognize a no
    > value
    >
    > Thanks
    > Leo
    >
    >
    >
     
    Steven Burn, Oct 24, 2005
    #2
    1. Advertising

  3. Steven Burn wrote:
    > IsNull()
    > IsEmpty()
    > Len()


    Since he is dealing with dates, I would add IsDate() to this list.

    >
    > ASP isn't like VB,


    You mean "vbscript isn't like VB" :)

    > so most of the time (depending on what you are
    > doing of course), you can switch datatype checks while you go ...
    >


    I think you meany to say: in vbscript, all variables are Variants, so their
    datatypes are not predefined, and vbscript does implicit conversions
    depending on the use being made of the data contained in the variable. For
    example, if a method expects a string argument, vbscript will implicitly
    convert the value being supplied to the method to a string (if possible).
    E.G:

    myDate = #2005/10/24# 'definitely contains a date
    Response.Write myDate

    Response.Write expects a string argument, so vbscript converts the date to a
    string

    >> Im having trouble in storing blank or space value on a variable wich
    >> data type is Date/Time, if i make a statement like this
    >>
    >> Field Data Type
    >> CPARCAVEDate Date/Time
    >>
    >> strCPARCAVEDate = rstFEVV.fields("CPARCAVEDate").value
    >>
    >> if strCPARCAVEDate = "" then
    >> counter = counter + 1
    >> end if
    >>


    Steven's advice will work for you. I was just adding some additional
    information.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Oct 24, 2005
    #3
  4. leo

    Steven Burn Guest

    Bob,
    hehe, cheers for the AI (was trying to keep it simple, lol).

    .... and yep.. meant VBScript ;o) (tend to class 'em as virtually the same
    thing personally - saves confusion for people I'm talking to, lol)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Bob Barrows [MVP]" <> wrote in message
    news:#...
    > Steven Burn wrote:
    > > IsNull()
    > > IsEmpty()
    > > Len()

    >
    > Since he is dealing with dates, I would add IsDate() to this list.
    >
    > >
    > > ASP isn't like VB,

    >
    > You mean "vbscript isn't like VB" :)
    >
    > > so most of the time (depending on what you are
    > > doing of course), you can switch datatype checks while you go ...
    > >

    >
    > I think you meany to say: in vbscript, all variables are Variants, so

    their
    > datatypes are not predefined, and vbscript does implicit conversions
    > depending on the use being made of the data contained in the variable. For
    > example, if a method expects a string argument, vbscript will implicitly
    > convert the value being supplied to the method to a string (if possible).
    > E.G:
    >
    > myDate = #2005/10/24# 'definitely contains a date
    > Response.Write myDate
    >
    > Response.Write expects a string argument, so vbscript converts the date to

    a
    > string
    >
    > >> Im having trouble in storing blank or space value on a variable wich
    > >> data type is Date/Time, if i make a statement like this
    > >>
    > >> Field Data Type
    > >> CPARCAVEDate Date/Time
    > >>
    > >> strCPARCAVEDate = rstFEVV.fields("CPARCAVEDate").value
    > >>
    > >> if strCPARCAVEDate = "" then
    > >> counter = counter + 1
    > >> end if
    > >>

    >
    > Steven's advice will work for you. I was just adding some additional
    > information.
    >
    > Bob Barrows
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >
     
    Steven Burn, Oct 24, 2005
    #4
  5. Steven Burn wrote:
    > Bob,
    > hehe, cheers for the AI (was trying to keep it simple, lol).
    >
    > ... and yep.. meant VBScript ;o) (tend to class 'em as virtually the
    > same thing personally - saves confusion for people I'm talking to,
    > lol)
    >

    .... except for the ones using jscript in their server-side code ;-)
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Oct 24, 2005
    #5
  6. leo

    Steven Burn Guest

    rofl yep.... 'cept I don't use that one personally ;o)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > Steven Burn wrote:
    > > Bob,
    > > hehe, cheers for the AI (was trying to keep it simple, lol).
    > >
    > > ... and yep.. meant VBScript ;o) (tend to class 'em as virtually the
    > > same thing personally - saves confusion for people I'm talking to,
    > > lol)
    > >

    > ... except for the ones using jscript in their server-side code ;-)
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    Steven Burn, Oct 24, 2005
    #6
  7. leo

    leo Guest

    Thanks guys this is really a great help

    thaaankssss...

    "Steven Burn" <> wrote in message
    news:#...
    > rofl yep.... 'cept I don't use that one personally ;o)
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    > > Steven Burn wrote:
    > > > Bob,
    > > > hehe, cheers for the AI (was trying to keep it simple, lol).
    > > >
    > > > ... and yep.. meant VBScript ;o) (tend to class 'em as virtually the
    > > > same thing personally - saves confusion for people I'm talking to,
    > > > lol)
    > > >

    > > ... except for the ones using jscript in their server-side code ;-)
    > > --
    > > Microsoft MVP -- ASP/ASP.NET
    > > Please reply to the newsgroup. The email account listed in my From
    > > header is my spam trap, so I don't check it very often. You will get a
    > > quicker response by posting to the newsgroup.
    > >
    > >

    >
    >
     
    leo, Oct 25, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Buchan
    Replies:
    2
    Views:
    730
    Kevin Buchan
    Dec 1, 2003
  2. Chris Berg
    Replies:
    0
    Views:
    795
    Chris Berg
    Oct 27, 2003
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,278
    Michael Borgwardt
    May 30, 2004
  4. Keith Cochrane
    Replies:
    2
    Views:
    626
    Keith Cochrane
    Aug 6, 2006
  5. Summu82
    Replies:
    5
    Views:
    869
    Richard Heathfield
    Jun 7, 2006
Loading...

Share This Page