Results 1 to 3 of 3

Thread: Checkbox values

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    North Carolina
    Posts
    131

    Checkbox values

    I have a table that consists of 5 fileds and three of those fields are yes/no boxes, and I have an asp page with three checkboxes on it. If I create an SQL statement "SELECT * FROM myTable" and the only record in the record set returns two true values and one false value for the three yes/no boxes in the access database. How would I assign the values to the checkboxes on my asp page?

    The following does not work:
    Code:
    <input type="checkbox" name="AC"  Value= <%=rs.fields("AC").value%> >
    Can someone give me an example of the correct syntax?

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Checkbox values

    Originally posted by MichaelC2468
    I have a table that consists of 5 fileds and three of those fields are yes/no boxes, and I have an asp page with three checkboxes on it. If I create an SQL statement "SELECT * FROM myTable" and the only record in the record set returns two true values and one false value for the three yes/no boxes in the access database. How would I assign the values to the checkboxes on my asp page?

    The following does not work:
    Code:
    <input type="checkbox" name="AC"  Value= <%=rs.fields("AC").value%> >
    Can someone give me an example of the correct syntax?
    Code:
    <%
    dim IsChecked
    if rs("AC") then
         IsChecked="checked"
    else
         IsChecked=""
    end if
    %>
    <input type="checkbox" name="AC"  <%=IsChecked%>>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425
    Or modify your SQL statement

    SELECT IIF(AC, "checked", "unchecked") AS StrAC FROM myTable

    If you can use TSQL...
    "Experience is something you don't get until just after you need it."

Posting Permissions

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



Click Here to Expand Forum to Full Width