Where In clause when updating?

Results 1 to 2 of 2

Thread: Where In clause when updating?

  1. #1
    Join Date
    Dec 1969

    Default Where In clause when updating?

    I&#039;m trying to update multiple rows in an access database from an asp form. I have a key of Item and this is the where clause:<BR>strSQL = strSQL & "Where Item IN(1,2,3,4,5,6,7,8,9,10)"<BR>which is updating the 10 records with all the same information as well as adding commas:<BR><BR>Update tblArtSupplies Set Test = &#039;hello, , , , , , , , &#039;Where Item IN(1,2,3,4,5,6,7,8,9,10) <BR><BR><BR> The rest of the update code that goes above the where is here:<BR>If Len(Request.Form("txtTest")) &#062; 0 Then<BR>&#039;Add the value to the SQL string<BR>If blnFirstParameter Then<BR>strSQL = strSQL & " Test = &#039;" <BR>Else<BR>strSQL = strSQL & " Test = &#039;" <BR>End If<BR>strSQL = strSQL & <BR>Cstr(Request.Form("txtTest")) & "&#039;"<BR>&#039;Set the first parameter flag to false<BR>blnFirstParameter = False<BR>End If<BR><BR>Any help is much appreciated.

  2. #2
    Join Date
    Dec 1969

    Default So what does the complete...

    ...SQL query look like?<BR><BR>WHere is your RESPONSE.WRITE debug output?<BR><BR>And are you aware that you are doing the same thing in both branches of the IF...ELSE that you showed?<BR><BR>[And there are lot simpler ways to do that then the "blnFirstParameter" code. See the ASPFAQs, category Queries, for some tricks.]<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