Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Help with Null please

Reply
 
Old 11-06-2008   #1 (permalink)
RICK


 
 

Help with Null please

How can I pass a Null value to an update script. Here is what I am currently
using. However, instead of filling in 01/01/1900 I want the value in the
field to be blank.

Sub DoUpdateAccession

if strADate = "" then
strADate = 01/01/1900
Else strADate = strADate
End if

Set rsUpdateAccession = server.createobject("adodb.recordset")
conn.webqry_UpdateAccession strADate

End Sub





My System SpecsSystem Spec
Old 11-06-2008   #2 (permalink)
mr_unreliable


 
 

Re: Help with Null please

RICK wrote:
Quote:

> How can I pass a Null value to an update script.
>

hi Rick,

As best I recall, an UNINITIALIZED vbs variable will
return a null, if tested.

Your "" value refers an empty STRING (not a null).

To test for null, you can use the IsNull function,
or you can use VarType and test for vbNull.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)
My System SpecsSystem Spec
Old 11-06-2008   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: Help with Null please


"RICK" <RICK@xxxxxx> wrote in message
news:CCD68295-DBA6-48DA-84C8-C4EA3B5A3E7B@xxxxxx
Quote:

> How can I pass a Null value to an update script. Here is what I am
> currently
> using. However, instead of filling in 01/01/1900 I want the value in the
> field to be blank.
>
> Sub DoUpdateAccession
>
> if strADate = "" then
> strADate = 01/01/1900
> Else strADate = strADate
> End if
>
> Set rsUpdateAccession = server.createobject("adodb.recordset")
> conn.webqry_UpdateAccession strADate
>
> End Sub
>
>
>
>
And if your intent is to assign a missing or not set to an attribute value,
generally you cannot simply assign a blank string. With AD objects you must
use the PutEx method and pass the ADS_PROPERTY_CLEAR constant (which has a
value of 1) to it. This clears the attribute. For example see this link:

http://www.microsoft.com/technet/scr.../usmdvb06.mspx

I don't know what you are updating, but I suspect a similar limitation
applies.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
[string]$a = $null; $a -eq $null; $a -eq "" PowerShell
why is $_.Name null for this? PowerShell
Why is this null? PowerShell
Re: "Error: 'null' is null or not an object" when trying to view video Vista performance & maintenance
Gotcha: $null to [string] IS NOT $null PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46