Variable in the field name.

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Variable in the field name.

    Hi All,

    I have one question. Usually, we can get data from table
    by using rst("userid") because we know the column name
    userid. Now, I have a variable to hold the column name. I
    want to get data value like this rst(var1). However, I got
    an error message.

    Thanks.
    my
    my Guest

  2. Similar Questions and Discussions

    1. Iterative Insert with Variable Field Name
      Hello, Someone must have come across this already, I need help with this insert query I have. I have a form that has variables as such:...
    2. variable named field calculated from variable named fields
      I have two form fields per line defined in a cfloop thusly: <cfloop index="i" from= "1" to= "100" Step="1"> <cfif isdefined("form.item_number_"...
    3. Display variable in text field
      Here's the code: <input type="text" name="myDate" id="myDate" value="#strDate#"> Not sure why this doesn't work. Instead of the value of the...
    4. name of field is in variable: how to use in SQL?
      Hi, The name of the field is in variable 'a'. How can i use it into SQL? This doesn't work: <% a="name" set obj =...
    5. Hidden field with variable problem
      Here is the code: <SELECT NAME="email" style="font-family: Verdana; font-size: 10pt; " size="1"> <% DO WHILE NOT objRS.EOF strEmail =...
  3. #2

    Default Re: Variable in the field name.

    What was the error message? Make sure that the variable does not contain any
    leading/trailing spaces. A better idea is to do:

    rst(Trim(var1))

    Also, print out the variable and see if that field exists in the resultset.

    --
    Manohar Kamath
    Editor, .netBooks
    [url]www.dotnetbooks.com[/url]


    "my" <mypeng4@yahoo.com> wrote in message
    news:03ed01c34fd0$60fc1170$a401280a@phx.gbl...
    > Hi All,
    >
    > I have one question. Usually, we can get data from table
    > by using rst("userid") because we know the column name
    > userid. Now, I have a variable to hold the column name. I
    > want to get data value like this rst(var1). However, I got
    > an error message.
    >
    > Thanks.
    > my

    Manohar Kamath [MVP] Guest

  4. #3

    Default Re: Variable in the field name.

    What is the code? What is "var1"? What does the table structure look like?
    What is the error message?

    In case there's any doubt, some information is better than none. :-)


    "my" <mypeng4@yahoo.com> wrote in message
    news:03ed01c34fd0$60fc1170$a401280a@phx.gbl...
    > Hi All,
    >
    > I have one question. Usually, we can get data from table
    > by using rst("userid") because we know the column name
    > userid. Now, I have a variable to hold the column name. I
    > want to get data value like this rst(var1). However, I got
    > an error message.
    >
    > Thanks.
    > my

    Aaron Bertrand - MVP 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