How many records does that select statement return to show them on the page?
Quote:
quote:Response.Write("<INPUT id=empno name=empno value='" & rs("rec_id") &"'>")
Response.Write("<INPUT id=empno name=empno value='" & rs("empno") &"'>")
|
Why do you have to name two form controls with the same name? What is the difference between rec_id and empno? or are they both having similar/sequencial numbers? And when you place that in a while loop, in what way can you differentiate the empno control for eah row?
Quote:
|
quote:empno=Request.Form("empno")
|
What can be the value of this in your udate page?
Answer for all these could end up saying this approach not the right one.
1) You can have your empno control named within the while loop in editrecords.asp as
<input .... name = "empno" & rs("empno") value>
This way for every record looped through, you would get its name as empno1, empno2, empno3... etc.
2) Initialize a counter variable and increment by 1 for every records in loop. and append it to the "empno" string as its name.
Code:
Dim RecCtr
RecCtr=1
do while rs.eof=false
Response.Write("<tr>")
Response.Write("<INPUT id=empno name='RecId" & cstr(RecCtr) & "' value='" & rs("rec_id") &"'>")
Response.Write("<INPUT id=empno name='EmpNo" & cstr(RecCtr) & "' value='" & rs("empno") &"'>")
Response.Write("<INPUT id=astrdate name='astrdate" & cstr(RecCtr) & "' value='" & rs("astrdate") &"'>")
...........
RecCtr=RecCtr+1
rs.movenext
loop
Response.Write "<input type='hidden' name='RecCtrVal' value='" & RecCtr-1 & "'>"
Also in your Edit page, you don't have to display the field like rec_id/EmpNo in textbox, which I assume is not allowed to edit. Instead you can use any one of that in hidden fields, so as to request its value in update page and use that in where clause while constructing the update statement. Just for the sake of differentiating each row, you can do a response.write of EmpNo, other than storing it in a hidden field.
And in update.asp you can request
RecCtrVal's value first and based on it value, you can implement a loop from 1 to
RecCtrVal
within which you can write an update statement that pertains to each row.
Code:
RecCtr=Request.Form("RecCtrVal")
For i = 1 to RecCtr
EmpNo=Request.Form("EmpNo" & RecCtr)
aStrDate=Request.Form("aStrDate" & RecCtr)
....
strSql = "Update YourTable Set YourDateCol='" & aStrDate & "' Where EmpNo = " & EmpNo
ConnectionObject.Execute(strSql)
Next
I would prefer the second solution.
Hope that helps.
Cheers!
_________________________
-Vijay G

Strive for Perfection
