VB.NET SP Parameter - Using a Condition Test as the False Part in an IIf

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default VB.NET SP Parameter - Using a Condition Test as the False Part in an IIf

    I have two asp:DropDownList items that have different label values, but the
    same data values. I would like the parameter for an SP to come from the
    value of the first dropdown if it has a value and from the other one if the
    first has no value.

    I am attempting to modify the SP's parameter value to acheive this by
    embedding an IIf as the false part of its parent IIf, such as:

    <Parameter Name="@companyCode" Value='<%#
    IIf((Request.Form("ddCompanyCode") <> ""), Request.Form("ddCompanyCode"),
    IIf(Request.Form("ddCompanyName") <> ""), Request.Form("ddCompanyName"),
    Nothing) %>' Type="VarChar" Direction="Input" />

    What I want this to do is use the value in ddCompanyCode if there is one;
    and if not, then use the value of ddCompanyName if there is one. If neither
    has a value, then pass null to the sp.

    The code above produces an error reading: "Argument not specified for
    parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean,
    TruePart As Object, FalsePart As Object) As Object'."

    Can I embed an IIf statement as the false part of a parent IIf statement?



    Les Matthews Guest

  2. Similar Questions and Discussions

    1. Pulling part of test out of a field in a database?
      I have a MySQL Database that has a description field, desribing the unit. At the end of that description it has a location. For instance. ...
    2. How to test SQL statements with parameter markers?
      Hi, Does anyone know how one could benchmark SQL statements with parameter markers? e.g.: SELECT * FROM SYSCAT.TABLES WHERE TABNAME=? I can...
    3. #24612 [Fbk->NoF]: getimagesize('test.jpg', $info) fails (only when 2nd parameter is used)
      ID: 24612 Updated by: sniper@php.net Reported By: pekka at studio-on-the dot net -Status: Feedback +Status: ...
    4. #24612 [Opn->Fbk]: getimagesize('test.jpg', $info) fails (only when 2nd parameter is used)
      ID: 24612 Updated by: sniper@php.net -Summary: Getimagesize fails on IM 5.4.6 created jpegs Reported By: pekka...
    5. Store Procedure plus parameter where condition..
      Hi, I am new programming in SQL Serever, and, I need to write a STORE PROCEDURE that recives a parameter to be used in the where statement,...
  3. #2

    Default Re: VB.NET SP Parameter - Using a Condition Test as the False Part in an IIf

    > <Parameter Name="@companyCode" Value='<%#
    > IIf((Request.Form("ddCompanyCode") <> ""), Request.Form("ddCompanyCode"),
    > IIf(Request.Form("ddCompanyName") <> ""), Request.Form("ddCompanyName"),
    > Nothing) %>' Type="VarChar" Direction="Input" />
    >
    > What I want this to do is use the value in ddCompanyCode if there is one;
    > and if not, then use the value of ddCompanyName if there is one. If
    neither
    > has a value, then pass null to the sp.
    >
    > The code above produces an error reading: "Argument not specified for
    > parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean,
    > TruePart As Object, FalsePart As Object) As Object'."
    >
    > Can I embed an IIf statement as the false part of a parent IIf statement?
    Could you just check for the property BEFORE passing it into the SP call?

    -Darrel


    darrel Guest

  4. #3

    Default Re: VB.NET SP Parameter - Using a Condition Test as the False Part in an IIf

    "darrel" <notreal@hotmail.com> wrote in message
    news:d3ed71$dm1$1@forums.macromedia.com...
    > Could you just check for the property BEFORE passing it into the SP call?
    I think I have it working now after adding parentheses around the expression
    of the embedded IIf, ie.
    <Parameter Name="@companyCode" Value='<%#
    IIf((Request.Form("ddCompanyCode") <> ""), Request.Form("ddCompanyCode"),
    IIf((Request.Form("ddCompanyName") <> ""), Request.Form("ddCompanyName"),
    Nothing)) %>' Type="VarChar" Direction="Input" />

    Thanks, Darrel. I may still follow your suggestion if I run into more
    problems.


    Les Matthews Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139