problem on Date/Time Data Type

L

leo

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
 
S

Steven Burn

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!
 
B

Bob Barrows [MVP]

Steven said:
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

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

Bob Barrows
 
S

Steven Burn

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!
 
B

Bob Barrows [MVP]

Steven said:
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 ;-)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top