im nearly there with this one and im sure it shouldnt be hard to solve, i just cant seem to find the solution.
ive got records being displayed, the user can then tick what records to delete... click delete.. it shows deleted records then you can go back to the screen, It works if one record is selected but any more it doesnt delete any so im sure there is a problem with my SQL statement.
the code for the 2 pages have been shown below:
The code for the selection page
=======================
Expand|Select|Wrap|Line Numbers
- <div align="center">
- <%
- If rssearchcnx.BOF and rssearchcnx.EOF Then%>
- We appolagise, but no flights were found matching your search
- </div>
- <p align="center"><a href="search.asp" target="mainFrame">please try again</a></p>
- <%Else%>
- <%If Not rssearchcnx.BOF Then%>
- <%
- Do While Not rssearchcnx.EOF
- %>
- <tr>
- <td ><%=rssearchcnx("flight_id")%></td>
- <td></td>
- <td>
- <form name="form" method="post" action="delete.asp">
- <input type="checkbox" name="flight_id" value="<%=(rssearchcnx.Fields.Item("flight_id").Value)%>"></td>
- </tr>
- <% rssearchcnx.MoveNext
- Loop
- %>
- </table>
- <%End If%>
- <%End If%>
- <input type="submit" value="Delete Selected Records">
- </form>
- <%
- rssearchcnx.Close
- searchcnx.Close
- %>
======================
Expand|Select|Wrap|Line Numbers
- <%
- Dim flight_id
- flight_id = Request.Form("flight_id")
- SQL="DELETE * FROM tbl_flight_details WHERE flight_id ='"+Request.Form("flight_id")+"'"
- Set MyConn=Server.CreateObject("ADODB.Connection")
- MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment3\airlines.mdb"
- Set MyRS=Server.CreateObject("ADODB.RecordSet")
- MyRS.Open SQL,MyConn
- %>
- </p>
- <table width="37%" border="0" align="center">
- <tr>
- <td align="center"><% Response.Write("<font face=Calibri>You have deleted flight number <B><font face=Calibri color=Red>" & flight_id)%>
kind regards
jason