Yeah...I know that....
But i selected the table from the dropdownmenu clicked submit, then all the records from the table selected is shown...but i don't know what to write after THIS "FROM". I have 6 different tables to choose from...
I post the whole code below:
The dropdown that let me select the table: (delete_link_form.asp)
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../../style/style.css" rel="stylesheet" type="text/css"> </head>
<body> <form name="form" method="post" action="delete_link_select.asp"> <table width="300" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Category:</td> <td><select name="catgy"> <option>MAin</option> <option>Music</option> <option>Pics</option> <option>Movie</option> <option>Otrher</option> <option>Admin</option> </select></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> </body> </html>
|
The page listing the records from the table selected in the previous dropdown (delete_select.asp)
<% Dim adoCon Dim rsDeleteLink Dim strSQL Dim lngRecordNo
lngRecordNo = CLng(Request.QueryString("ID"))
Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DBQ=" & Server.MapPath("../../db/db.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};uid=;pwd=12345;" Set rsDeleteLink = Server.CreateObject("ADODB.Recordset")
category = Request("catgy") select case category case "Main" strSQL="select * from Main" case "Music" strSQL="select * from Music" case "Pics" strSQL="select * from Pics" case "Movie" strSQL="select * from Movie" case "Other" strSQL="select * from Other" case "Admin" strSQL="select * from Admin" end select rsDeleteLink.Open strSQL, adoCon
Do While not rsDeleteLink.EOF
Response.Write ("<br>") Response.Write ("<a href=""delete_link.asp?ID=" & rsDeleteLink("ID") & """>") Response.Write (rsDeleteLink("Link_Text")) Response.Write ("</a>") Response.Write ("<br>") Response.Write (rsDeleteLink("Link")) Response.Write ("<br>") rsDeleteLink.MoveNext
Loop
rsDeleteLink.Close Set rsDeleteLink = Nothing Set adoCon = Nothing %>
|
The code that should be executed when clicking on one of the listed records (delete_link.asp)
<% Dim adoCon Dim rsDeleteEntry Dim strSQL Dim lngRecordNo
lngRecordNo = CLng(Request.QueryString("ID"))
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DBQ=" & Server.MapPath("../../db/db.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};uid=;pwd=12345;"
Set rsDeleteEntry = Server.CreateObject("ADODB.Recordset")
strSQL="SELECT * FROM ????? WHERE ID=" & lngRecordNo rsDeleteEntry.LockType = 3
rsDeleteEntry.Open strSQL, adoCon
rsDeleteEntry.Delete
rsDeleteEntry.Close Set rsDeleteEntry = Nothing Set adoCon = Nothing
Response.Redirect "../../index.asp" %>
|
So...what goes instead of the question marks? Or could this be solved easier?