I am creating a program that will list program times for people who
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from the
database and posts these programs for people to view (program type,
date, time, etc...). I am having trouble creating an edit option. When
bring up the edit page i want it to read the database and dynamically
create a table that has a button for each record in the recordset. I
want to be able to click that "edit" button and in a new window the
form appears filled out with the current record's information filled
in. However, to do this I am having trouble pulling out the button
name (which is the name of the DB primary key survey num) and passing
it to the other edit form. Some help me....PS i know the below code is
incorrect because it passes 28 which is the last record in the record
set, not the current. I know why it does this, I just do not know how
to fix it.
RSSQL = "Select * from Workshops where workshopdate Date()"
rs.open RSSQL,conn,1,1
if rs.recordcount = 0 then
%There are no upcoming workshops.
<%
response.end
end if
rs.movefirst
%>
<table width="499" border="1">
<tr>
<th width="139" scope="col"><di v align="center"> Date</th>
<th width="300" scope="col"><di v align="center"> Time</th>
<th width="300" scope="col"><di v align="center"> Location</th>
</tr>
<%
Do until rs.eof
WorkshopNum = rs("WorkshopNum ")
WorkshopDate = rs ("WorkshopDate" )
WorkshopStartTi me = rs("WorkshopSta rtTime")
WorkshopEndTime = rs("WorkshopEnd Time")
WorkshopLocatio n = rs("WorkshopLoc ation")
StartTime = Instr(WorkshopS tartTime,":")
EndTime = Instr(WorkshopE ndTime,":")
StartAMPM = right(WorkshopS tartTime, 2)
EndAMPM=right(W orkshopEndTime, 2)
WorkshopStartTi me=Left(Worksho pStartTime, StartTime+2)
WorkshopEndTime =Left(WorkshopE ndTime, EndTime+2)
%>
<tr>
<td><div align="center"> <%Response.writ e WorkshopDate%></td>
<td><div align="center"> <%Response.writ e WorkshopStartTi me &
StartAMPM & "-" & WorkshopEndTime & EndAMPM%></td>
<td><div align="center"> <%Response.writ e WorkshopLocatio n%></td>
<td>
<input name="<%Respons e.Write WorkshopNum%>" type=Button onclick=
"window.open('e ditworkshop111. asp'); " value="Edit This Workshop"></
td>
</tr>
<%
session("worksh opnum")= workshopnum
rs.movenext
loop
%>
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from the
database and posts these programs for people to view (program type,
date, time, etc...). I am having trouble creating an edit option. When
bring up the edit page i want it to read the database and dynamically
create a table that has a button for each record in the recordset. I
want to be able to click that "edit" button and in a new window the
form appears filled out with the current record's information filled
in. However, to do this I am having trouble pulling out the button
name (which is the name of the DB primary key survey num) and passing
it to the other edit form. Some help me....PS i know the below code is
incorrect because it passes 28 which is the last record in the record
set, not the current. I know why it does this, I just do not know how
to fix it.
RSSQL = "Select * from Workshops where workshopdate Date()"
rs.open RSSQL,conn,1,1
if rs.recordcount = 0 then
%There are no upcoming workshops.
<%
response.end
end if
rs.movefirst
%>
<table width="499" border="1">
<tr>
<th width="139" scope="col"><di v align="center"> Date</th>
<th width="300" scope="col"><di v align="center"> Time</th>
<th width="300" scope="col"><di v align="center"> Location</th>
</tr>
<%
Do until rs.eof
WorkshopNum = rs("WorkshopNum ")
WorkshopDate = rs ("WorkshopDate" )
WorkshopStartTi me = rs("WorkshopSta rtTime")
WorkshopEndTime = rs("WorkshopEnd Time")
WorkshopLocatio n = rs("WorkshopLoc ation")
StartTime = Instr(WorkshopS tartTime,":")
EndTime = Instr(WorkshopE ndTime,":")
StartAMPM = right(WorkshopS tartTime, 2)
EndAMPM=right(W orkshopEndTime, 2)
WorkshopStartTi me=Left(Worksho pStartTime, StartTime+2)
WorkshopEndTime =Left(WorkshopE ndTime, EndTime+2)
%>
<tr>
<td><div align="center"> <%Response.writ e WorkshopDate%></td>
<td><div align="center"> <%Response.writ e WorkshopStartTi me &
StartAMPM & "-" & WorkshopEndTime & EndAMPM%></td>
<td><div align="center"> <%Response.writ e WorkshopLocatio n%></td>
<td>
<input name="<%Respons e.Write WorkshopNum%>" type=Button onclick=
"window.open('e ditworkshop111. asp'); " value="Edit This Workshop"></
td>
</tr>
<%
session("worksh opnum")= workshopnum
rs.movenext
loop
%>
Comment