|
| |
|
|
jgeatty
Posts: 199 Joined: 10/14/2004 Status: offline
|
UPDATE using textarea box - 8/21/2008 16:25:57
I have a textarea box that I want to list multiple records seperated by commas that will submit to a second page to do the UPDATE query. Here is my code but it is not working: decom.asp: <form method="POST" action="decom2.asp"> <p><textarea rows="10" name="list" cols="50"></textarea></p> <p><input type="submit" value="Submit" name="B1"></p> </form> this submits to decom2.asp: <body> <% dim list list = request.form("list") %> <!--#include file="../../_fpclass/fpdblib.inc"--> <% fp_sQry="UPDATE tblFullProfile SET Decom='Yes' WHERE ServerName=('" & list & "')" fp_sDefault="ServerName=" fp_sNoRecords="Records updated." fp_sDataConn="NewServerForm" fp_iMaxRecords=1 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=False fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_iDisplayCols=16 fp_fCustomQuery=True BOTID=0 fp_iRegion=BOTID %> <!--#include file="../../_fpclass/fpdbrgn1.inc"--> <!--#include file="../../_fpclass/fpdbrgn2.inc"--> </body> As you can see, I just want it to update one column (Decom) to "Yes" with the list I provide on the first page. It is not working for some reason... any suggestions? Thanks in advance!
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: UPDATE using textarea box - 8/21/2008 19:13:39
quote:
<% dim list list = request.form("list") %> What's happening is that "list" is a list and you need to separate each one into it's own portion of the statement. I don't use DRW's anymore but I'd attempt it something like this. Replace the above chunck with something like this: <%
dim list, myCriteria
myCriteria = ""
'create an array of the "list" items
listArray = split(request.form("list"),",")
'start the array looping
For i = 0 To ubound(listArray)
'confirm we have an entry in there and not just a blank
If trim(listArray(i) & "") > "" Then
'add another criteria to the update list
myCriteria = myCriteria & "(ServerName='" & listArray(i) & "') OR "
End If
Next
'now we lop off the last " OR "
myCriteria = left(myCriteria,Len(myCriteria)-4)
%> And now we make our fp_sQry line like so: fp_sQry="UPDATE tblFullProfile SET Decom='Yes' WHERE " & myCriteria Did that make any sense? See, we have to create a separate "Servername = 'blah'" option for each item in the list. At least that's how I'd attempt it. Hope it helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|