Passing Values to SQL

Results 1 to 3 of 3

Thread: Passing Values to SQL

  1. #1
    Join Date
    Dec 1969

    Default Passing Values to SQL

    &nbsp;<BR>I have 5 Check Boxes (in Page1.asp) and User may select one check Box or all 5 Check boxes to get the data from DB.<BR><BR>How can i pass these check box values to my Sql Statement (to Page2.asp) (It may be One Value or 3 Values or 5 Values)<BR><BR>Do i need to pass values like this to Second Page?<BR><BR>Chk1 = Request.Form("ChkVal1")<BR>Chk2 = Request.Form("ChkVal2")<BR>Chk3 = Request.Form("ChkVal3")<BR>Chk4 = Request.Form("ChkVal4")<BR>Chk5 = Request.Form("ChkVal5")<BR><BR>ChkValues = Chk1&Chk2&Chk3&Chk4&Chk5<BR><BR>Is this right way to pass Check Box values to Page2.asp from Page1.asp?<BR><BR>Here is my SqlL<BR><BR>"SELECT type, year, desc, TotCnt FROM chepep Where report_year = &#039;Here i have to put the values from those CheckBoxes (one value or 2 values or 5 values)<BR><BR>Please help me here... Do i need to Use "IN" in my SQL statement?

  2. #2
    Join Date
    Dec 1969

    Default RE: Passing Values to SQL

    Question 1-yes<BR>Question 2-yes<BR>Question 3-You can do either, but "IN" may be cleaner. Otherwise you would have to do "....WHERE report_year = &#039;" & chk1 & "&#039; OR report_year = &#039;" & chk2 & "&#039; OR ......

  3. #3
    Join Date
    Dec 1969

    Default ASPFAQs, category Databases, Queries

    Click on the link to ASPFAQs at center above.<BR><BR>Click on the noted category.<BR><BR>Look for your FAQ.<BR><BR>*********<BR><BR>I should note that the big goof you made was in giving different NAMES to the individual checkboxes. If they all have the same name, it&#039;s truly trivial. As the FAQ will show you.<BR><BR>

Posting Permissions

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