Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

INSANITY - UPDATE form with a checkbox?? ASP/VBScript/MSSQL

LEGEND ,
Mar 20, 2007 Mar 20, 2007
Sorry, but I've just "burst" with anger and need some help. :o)
ASP/VBScript/MSSQL

I have an UPDATE form that has a checkbox. If the checkbox field in the
database is "True" it displays a checked check box, if it is "False" it
displays an unchecked check box.

If a user places a check in the checkbox and submits the UPDATE form, I am
getting the following error:
Wrong number of arguments or invalid property assignment: 'MM_IIf'
Line 40

Line 40 is, of course, the reference to the checkbox:
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, -1,
MM_IIF(Request.Form("deletevoucher"), Request.Form("deletevoucher"), null))
' adDouble

Now, I know that I need to change the type here. Can some kind soul please
tell me what it SHOULD be?

It is this kind of problem that makes me want to through Dreamweaver out of
the window and please don't patronise me with "it isn't Dreamweavers fault".
DW creates the incorrect code...who elses fault is it?? Tired, oh so very
tired, of Dreamweaver.

Thank you, in advance, for any advice offered.
Nath.

(it has been a long day)


TOPICS
Server side applications
726
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2007 Mar 20, 2007
So, the answer is:

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, -1,
MM_IIF(Request.Form("deletevoucher"), 1, 0)) ' adDouble

This is what Dreamweaver automatically inserts as the "correct" code (which
doesn't work):

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, -1,
MM_IIF(Request.Form("deletevoucher"), Request.Form("deletevoucher"), null))
' adDouble

Questions:

1) Why has DW doubled up the Request.Form("deletevoucher") bit?
2) Why has it inserted "null" for the checkbox when it clearly should be 1,
0?
3) Why can't DW automatically detect that the item is a checkbox and code
the UPDATE accordingly? Now, I know people will say "DW is only good for
basics" but, jeesh, a simple check box in an update form is hardly rocket
science these days, is it? I know it's rocket science to ME, but I mean in
web design software terms, it's hardly a "biggie" now is it?

Am I asking too much for the £750.00+ I paid for Studio? :o(

Frustrating, frustrating software.

Nath.

"tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
news:etp0th$4j5$1@forums.macromedia.com...
> Sorry, but I've just "burst" with anger and need some help. :o)
> ASP/VBScript/MSSQL
>
> I have an UPDATE form that has a checkbox. If the checkbox field in the
> database is "True" it displays a checked check box, if it is "False" it
> displays an unchecked check box.
>
> If a user places a check in the checkbox and submits the UPDATE form, I am
> getting the following error:
> Wrong number of arguments or invalid property assignment: 'MM_IIf'
> Line 40
>
> Line 40 is, of course, the reference to the checkbox:
> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5,
> 1, -1, MM_IIF(Request.Form("deletevoucher"),
> Request.Form("deletevoucher"), null)) ' adDouble
>
> Now, I know that I need to change the type here. Can some kind soul
> please tell me what it SHOULD be?
>
> It is this kind of problem that makes me want to through Dreamweaver out
> of the window and please don't patronise me with "it isn't Dreamweavers
> fault". DW creates the incorrect code...who elses fault is it?? Tired,
> oh so very tired, of Dreamweaver.
>
> Thank you, in advance, for any advice offered.
> Nath.
>
> (it has been a long day)
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 20, 2007 Mar 20, 2007
What is your data type in your DB? Just match the data type in your param with the data type in the DB. Also, make sure the checkbox value that is being submitted is of the same data type as well.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2007 Mar 20, 2007
LATEST

"tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
news:etp2jp$6rc$1@forums.macromedia.com...

> 1) Why has DW doubled up the Request.Form("deletevoucher") bit?
> 2) Why has it inserted "null" for the checkbox when it clearly should be
> 1, 0?
> 3) Why can't DW automatically detect that the item is a checkbox and code
> the UPDATE accordingly? Now, I know people will say "DW is only good for
> basics" but, jeesh, a simple check box in an update form is hardly rocket
> science these days, is it? I know it's rocket science to ME, but I mean
> in web design software terms, it's hardly a "biggie" now is it?
>
> Am I asking too much for the £750.00+ I paid for Studio? :o(

The answer to all of the above is that you selected double (which is a
double precision floating point number, like 35.789) for a checkbox control.
That's just wrong. In your database, it's probably either a bit or tinyint.
If you had selected an appropriate data type, DW would have made better
assumptions about what you're trying to do.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines