Invalid use of Null: 'CStr' - checkbox UPDATE - what the heck?!

Jeesh...you just think you're beginning to understand things
and then
something "weird" happens! Anyway, what is wrong with this?:
<input <%If
(CStr((rsCustomer.Fields.Item("deletethis").Value)) =
CStr("True")) Then Response.Write("checked=""checked""") :
Response.Write("")%> name="deletethis" type="checkbox"
id="deletethis"
value="1" />
I have this as part of an UPDATE form. If I place a tick in
the checkbox,
and submit it, it updates the record correctly as having a 1
value (True).
If I open the same UPDATE form, for the same record, it
displays a check in
the check box - great.
However, if the "deletethis" in the user record is initially
"False" (0),
the default value for all of my records, and I submit the
update form
without changing the deletethis checkbox, it seems to be
submitting a blank
value which means that when I re-open the UPDATE form for
this record, and
submit the UPDATE again, I get this:
Error Type:
Microsoft VBScript runtime (0x800A005E)
Invalid use of Null: 'CStr'
//edit-customer.asp, line 838
I'm sure this is because it is trying to submit a blank
value, where it
needs to be either 0 or 1. But why is it submitting
"deletethis" as a blank
value?
When I check my SQL database, the deletethis field shows no
value, not even
the word NULL and certainly not a 1 or 0.
Also, if one of my records already has a 1 value, and I
change this in the
UPDATE form, but "unchecking" the deletethis checkbox, again
it submits a
blank value! Nyaarg!
For reference, here is my UPDATE code:
<%
If (CStr(Request("MM_update")) = "editcontactdetails") Then
If (Not MM_abortEdit) Then
' execute the update
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_connNAME_STRING
MM_editCmd.CommandText = "UPDATE dbo.tblCustomers SET
firstnames = ?,
surname = ?, billbusiness = ?, billaddress = ?, billaddress1
= ?,
billaddress2 = ?, billcity = ?, billregion = ?, billcountry =
billpostcode = ?, billtelephoneday = ?, billmobile = ?,
billtelephoneeve =
?, billemail = ?, billlocationinfo = ?, username = ?,
password = ?,
deletethis = ? WHERE customerID = ?"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param1", 202,
1, 150, Request.Form("firstnames")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param2", 202,
1, 100, Request.Form("surname")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param3", 202,
1, 150, Request.Form("businessname")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param4", 202,
1, 100, Request.Form("billaddress")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param5", 202,
1, 100, Request.Form("billaddress1")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param6", 202,
1, 100, Request.Form("billaddress2")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param7", 202,
1, 100, Request.Form("billcity")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param8", 5,
1, -1, MM_IIF(Request.Form("billregion"),
Request.Form("billregion"), null))
' adDouble
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param9", 202,
1, 100, Request.Form("billcountry")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param10", 202,
1, 75, Request.Form("billpostcode")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param11", 202,
1, 75, Request.Form("billtelephoneday")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param12", 202,
1, 50, Request.Form("billmobile")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param13", 202,
1, 75, Request.Form("billtelephoneeve")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param14", 202,
1, 150, Request.Form("billemail")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param15", 203,
1, 1073741823, Request.Form("billlocationinfo")) '
adLongVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param16", 202,
1, 25, Request.Form("username")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param17", 202,
1, 25, Request.Form("password")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param18", 5,
1, -1, MM_IIF(Request.Form("deletethis"),
Request.Form("deletethis"), null))
' adDouble
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param19", 5,
1, -1, MM_IIF(Request.Form("MM_recordId"),
Request.Form("MM_recordId"),
null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "index.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" &
Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" &
Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
Please, can someone just tell me what it is, because I can't
find an
explanation in the documentation!
Much appreciated
Nath.

Point taken David, ;o) but you must admit that Dreamweaver is
not strictly
marketed as such.
"With Dreamweaver 8, web developers go from start to finish,
creating and
maintaining basic websites to advanced applications that
support best
practices and the latest technologies."
(source:
http://www.adobe.com/uk/products/dreamweaver/)
Oh, and then there's the price tag! :-o
I personally think they could have marketed "Notepad" a
little better! :o)
Nath.
"David Powers" <[email protected]> wrote in message
news:ej25kb$7nv$[email protected]..
> Lionstone wrote:
>> DW offers a helping hand when it comes to database
integration, but you
>> should expect to do the bulk of the work yourself.
Beyond a simple
>> insert/update/delete of a single record in a single
table, it's all up to
>> you.
>
> Hear, hear. If only more people realized that this is
the case, they would
> find Dreamweaver a lot easier to use.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
>
http://foundationphp.com/

Similar Messages

  • #ixGetData Error: Invalid use of Null

    Hi,
    I am running a basic XL Reporter report and I am getting Other Data for the Territory.  It pulls through data for a records that have a territory but when it reaches one that is Null it creates the error above.
    I presume I need to use the condition in 'Get  Other Data' but everything I try it doesn't like.
    Does anyone have any idea's of what condition to use to return " " if Null.
    I have tries standard SQL but it doesn't seem to work.
    thanks
    Mark

    Hi Mark,
    Hope you could get some ideas from those threads:
    XL Reporter-How the Get Other Data works in formula builder?
    ADD-ON - XL Reporter - Error: "#ixGetData Error: Invalid use of Null"
    Re: Get Other Data
    XLR-Get Other Data Error
    Thanks,
    Gordon

  • Microsoft VBScript runtime error '800a005e' Invalid use of Null: 'clng' /mc/functions/rpt_downline.asp, line 187

    while I am in one of my sites I can access most pages except one and I get this message.

    "samspram" <[email protected]> wrote in
    message
    news:fifhoq$cr7$[email protected]..
    > Hi There
    > Thanks for the reply.
    > It is a MySQL DB, the fields I am referencing are TEXT
    datatypes and I
    > have
    > tried referencing them both left and right.
    > The data stored in the fields are comma separated
    strings e.g. 1, 2, 3, 4,
    > which I am loading into Session variables at login with
    the following
    > code:-
    > Session("allowedsubmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_sub_menus").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_sub_menus").Value) -
    1))
    > Session("allowedtopmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_top_menus").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_top_menus").Value) -
    1))
    > Session("allowedempmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_emp_menus").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_emp_menus").Value) -
    1))
    > Session("allowedcoys") =
    > Left(rsLogin.Fields.Item("u_allowed_companies").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_companies").Value) -
    1))
    >
    > If I load the data into a variable before performing the
    Left() function
    > on
    > the field then it goes past the lines OK but when I try
    and use the
    > Session
    > variable it then throws the Invalid Use of Null error
    again.
    > i.e.
    > Dim varNum
    > varNum =
    (Len(rsLogin.Fields.Item("u_allowed_top_menus").Value) - 1)
    > Session("allowedsubmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_sub_menus").Value,
    varNum)
    > Code will execute past the loading of sessions in this
    way but when I try
    > to
    > use the session later i.e. as with the Split() function
    I get the same
    > error
    > again.
    >
    > Regards
    > Brendan
    You are referencing the Recordset Column Value multiple
    times.
    try putting it into a variable first
    varValue = rsLogin.Fields.Item("u_allowed_sub_menus").Value
    then proceed with your operations using that variable
    Session("allowedsubmenus") = Left(varValue , (Len(varValue )
    - 1))

  • Unable to connect to XL Reporter (Invalid use of Null)

    I am facing problem to connect to XL reporter (2007B, PL 15). Would appreciate if anybody who encountered similar problem before can give advise on the possible solution. Thank you.
    Unable to connect to XL Reporter.
    Error! User authentication failed!
    Cause: Invalid use of Null.

    I have done the recommendations on those threads, but now the error changed. Upon connecting the error message is:
    There was one or more execution errors!
    Source: Microsoft OLE DB Provider for SQL Server
    Message: Must declare the scalar variable "@strRow4AllCommonDimensions".
    Script: SBOOEM\MSSQL\ixPartnerObjects.sql(5710)
    (Logfile: DblUtilExec.Log)
    Then, the following error message is displayed:
    Unable to connect to XL Reporter.
    Error! User authentication failed!
    Cause: ExtCode -1
    I tried the ConnectionManager.exe but problem persists. If you have any other suggestions please let me know. Thank you.

  • Error in SQL Query The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query

    hi Experts,
    while running SQL Query i am getting an error as
    The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
    select  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
    T2.LineText
    from OQUT T0  INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
    QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
    group by  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
    ,T2.LineText
    how to resolve the issue

    Dear Meghanath,
    Please use the following query, Hope your purpose will serve.
    select  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
    CAST(T2.LineText as nvarchar (MAX))[LineText]
    from OQUT T0  INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
    QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
    group by  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
    ,CAST(T2.LineText as nvarchar (MAX))
    Regards,
    Amit

  • HT1386 I synced (updated) my iphone to itunes and some songs were deleted from my iphone playlist on my phone.  On the computer, a circle is next to the song and the title faded out.  What the heck is that all about and how do I get my songs back onto my

    I synced (updated) my iphone to itunes and some songs were deleted from my iphone playlist on my phone.  On the computer, a circle is next to the song and the title faded out.  What the heck is that all about and how do I get my songs back onto my phone playlist?  Never happened before.  My software is up to date?

    http://support.apple.com/kb/HT2519

  • I just downloaded an update to ITunes this morning, and now I am getting an error message saying iTunes can't start because MSVCR80.dll is missing from my computer. What the heck happened?

    I just downloaded the latest update for iTunes this morning, and now I am getting a message saying that iTunes can't start because MSVCR80.dll is missing from my computer.  What the heck happened?

    Troubleshooting issues with iTunes for Windows updates - MSVCR80

  • How do i uninstall iphoto? it was preinstalled on my macbook pro when I bought it used and I can only update with the previous owners password.

    how do i uninstall iphoto? it was preinstalled on my macbook pro when I bought it used and I can only update with the previous owners password.

    Do you have the current MacOS X version 10.10.2?
    Then you can simply move iPhoto from the Applications folder to the Trash,
    sign into the App Store with your own AppleID
    reload the "Featured" main page of the AppStore with ⌘R,
    then download iPhoto with your own AppleID.
    Make a backup of your iPhoto Library, before your launch the new iPhoto the first time,
    If your current system is not Yosemite, you can only buy a boxed iLife 11 version of iPhoto to install it independent of the previous owner.

  • None of any of the pictures on Facebook can be opened and seen on the website, I have absolutely no problem on Safari, but I would much rather use Firefox..What the heck is going on????

    About a week ago, I had no problem clicking on pictures to open them to bigger size.....As of about 4 days ago - If I try to open a picture on Facebook, it shows the comments but no picture..I don't know what is going on!!! It works fine on Safari, but I would much rather use Mozilla for my own selfish reasons, WHAT THE HECK IS GOING ON????? ( I'VE TRIED EVERYTHING!!!!!)
    == This happened ==
    Every time Firefox opened
    == About a week ago.....

    I agree the phones are supposed to come with the battery and battery door missing that is policy of every wireless company. The problem is that the rep that you spoke with wasn't being as thorough as they could have been to ensure that you got complete equipment, is was a processing error from the first representative. Most of the information for exchanging a phone is auto completed by the computers as well so when the rep processes the exchange they don't have any say so as to what is actually in the shipping box so being that you didn't activate the droid 3 on your account when you called in about the missing battery and complained the computer only recognized the droid x because that probably what you had activated on your account, so that's why the second replacement was droid x equipment and not droid 3

  • HT201270 In layman terms, what the heck does updating your carrier settings mean and how does it effect me in the real world?

    In Layman terms, what the heck does updating your carrier settings mean, and how does it effect me in the real world?

    No offense, but what carrier?  what data and what service? 
    I get a bogus window hovering in my itunes page, telling me I have to update information, that I don't want to manage. 
    I am not upset or unappreciative of your feedback, quite the opposite, I can't believe anyone actually monitors peoples frustrations. 
    I just want to make sure I don't allow information about me that is not necessary.  I just want to listen to music and have a phone and have an ipad. 
    Everything else about apple is way to propriatory. I don't want to do anything that isn't very simple. 
    Most importantly, there never seems to be any (human being) that can answer a telephone call anymore. 
    Contact us, means...send us an email about something you don't know anything about, and I don't even know that questions to ask.
    I am not allowed to be ignorant.  If I am I wait days for answers.....

  • WHAT THE HECK! eversince I updated my itunes... My laptop keeps on crashing, i try to change the volume on itunes and it doesnt even move, and I quit Itunes but apparently it won't ever quit... I lost all my  paper work cuz it crashed 4 times this week.

    WHAT THE HECK! eversince I updated my itunes... My laptop keeps on crashing, i try to change the volume on itunes and it doesnt even move, and I quit Itunes but apparently it won't ever quit... I lost all my  paper work cuz it crashed 4 times this week.

    Try disabling the computer's antivirus and firewall for the network problem.
    Also for the original problem try the following if Ana's suggestions does not work
    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • HT1947 "Up next" feature makes a mess out of controlling what the heck is played using the iOS remote app.

    Tell me if I am wrong, but it seems to me that the "Up next" feature makes a mess out of controlling what the heck is played through the Apple TV using the iOS remote app.  The whole thing seem uber-anti-intuitive.  I am a long time user (as much and anyone is long time for any of this stuff) of the iOS remote app, and ATV to play music though a stereo system.  Up to a couple of weeks ago, I could sit in my chair, start the iPhone remote app, pick a playlist and either start from the beginning, or if the first track didn't grab me at that moment, go ahead and switch to, say, track 6 -- the whole playlist would "sit there" and be available for further browsing.  With the new system, if I hit a playlist the songs will go into "Up Next".  If as I described in the last sentence, the first song is not getting it for me, and I switch to track 6 , the "Up Next" list is lopped off and only tracks 7 onward will be shown.  I can't go back and browse the first 5 tracks (6 actually) -- they're vaporized.  The idea of browsing your own music has been killed; I guess this "Up Next" concept is for folks who like maybe a couple of dozen songs that are picked from different places and want to play them in different orders of something -- it just seems like a crummy idea.  If under the scenario I described I want to go back and play that first (or second through fifth) song on the original playlist, I have to go out and fish it out of the library somehow and just keep messing around and around.  There have been times when I didn't know what the heck was going to come out of the speakers.  It seems like the remote user has not been considered in the "dramatically improved" iTunes 11", with the "cleaner user interface" .  To me it is "dramatically akin to dog-doo", which, of course is not cleaner than much of anything.  If I can't get this working decently, then I'm really thinking of investigating some other type of system like DLNA.  Any suggestions?

    Same problem here.  I have so many problems with this remote app.  Is there an iTunes API? I would like to write my own remote app that actually works.

  • I was using my old iPhone 4 as an iPod for 4  months when one day I got this error message saying "phone is deactivated visit your local to reactive" ... what the heck??? now the freakin thing won't even charge!!!

    I was using my old iPhone 4 as an iPod for 4  months when one day I got this error message saying "phone is deactivated visit your local to reactive" ... what the heck??? now the freakin thing won't even charge!!!

    Nope. I've already turned off cellular data. It happens regardless, as soon as it is done powering on.
    I suspect it might just be built into the phone's firmware to do that... and I have to hit "ignore" whenever it happens, but I just wanted confirmation of that...

  • HT5567 well after updation to ios6.0.1 My wifi button has turned to grey mode ,i cant turn it on at all and when i tried to restore it my battery life turned in short life period .,,,i dnt know what the heck is this..pls help

    well after updation to ios6.0.1 My wifi button has turned to grey mode ,i cant turn it on at all and when i tried to restore it my battery life turned in short life period .,,,i dnt know what the heck is this..pls help

    The reapair shop is probably responsible. And now that you took it to a third party and not to apple store, Apple will not touch your phone at all. So you will probaly have to buy a new one or go back to the reapir shop and hope they can fix it.

  • [svn:fx-trunk] 7467: Removing font face validation so that the requested style is used whether or not it matches what the font describes .

    Revision: 7467
    Author:   [email protected]
    Date:     2009-06-01 08:10:15 -0700 (Mon, 01 Jun 2009)
    Log Message:
    Removing font face validation so that the requested style is used whether or not it matches what the font describes. This allows font families to be constructed from multiple fonts including those that do not describe their style in the OS/2 table. Note SWF and the Flash Player restriction of only support 4 faces per font family (plain, bold, italic, and bold & italic) still applies.
    QE: Yes, please look out for negative test cases for embedded font styles that no longer fail. Also look out for minor font outline differences given that we use AFEFontManager by default for DefineFont3 embedded fonts. If you require the legacy font outlines you can configure the test case to use the BatikFontManager (which has been retained for MPL distributions).
    Doc: Yes, we'll release note the relaxed font embedding rules for font faces. I'll annotate the bugs below.
    Reviewer: Paul
    Bugs:
    SDK-14309 - fontWeight should not be restricted
    SDK-14308 - fontWeight: bold is required when specifying certain fonts in the CSS file
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-14309
        http://bugs.adobe.com/jira/browse/SDK-14308
    Modified Paths:
        flex/sdk/trunk/frameworks/flex-config.xml
        flex/sdk/trunk/lib/flex-fontkit.jar
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/common/MxmlConfiguration.java
        flex/sdk/trunk/modules/swfutils/src/java/flash/fonts/BatikFontManager.java
        flex/sdk/trunk/modules/swfutils/src/java/flash/fonts/CachedFontManager.java
        flex/sdk/trunk/modules/swfutils/src/java/flash/fonts/FontManager.java
        flex/sdk/trunk/modules/swfutils/src/java/flash/fonts/JREFontManager.java

    i have sorted this out by placing it in the webapps dir of my tomcat. The problem is when i map a servlet in my own web.xml, it stops working. At this time i just want to map 1 servlet called main, and it is in C:\Tomcat 5.5\webapps\cmt3082\WEB-INF\classes\myProject
    cmt3082 is my project folder
    WEB-INF holds my web.xml
    classes holds my servlet, in this case main.java
    myProject holds my Java classes
    So i have mapped main like this for now
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
    <servlet> 
    <servlet-name>main</servlet-name> 
    <servlet-class>classes.main</servlet-class>
    </servlet>
    </web-app>But with this in place, it gives me the error cannot find requested resource. And i missing somthing in the web.xml?
    cheers

Maybe you are looking for