Ciao,
avrei bisogno di aiuto!
Sto facendo un admin in ASP per un DBAccess contente immagini e descrizione; praticamente dopo aver caricato sul DB le immagini, si devono "creare" delle "schede_tecniche" (sempre in asp) prendendo le immagini dal DB e scrivendo i relativi testi.
Inoltre ci deve essere la possibilità di cancellare queste schede_tecniche.
Quanto riguarda il caricamento immagini nel DB tutto ok.
Quanto riguarda l'inserimento nuove schede_tecniche nel DB tutto ok.
La cancellazione mi sta creando problemi!!!
Praticamente io faccio cercare da un elenco la scheda_tecnica da cancellare, cliccando su "cerca" mi compare il titolo della scheda_tecnica e cliccando su "cancella scheda" mi DOVREBBE cancellare la scheda e lasciarmi la possibilità di cliccare sul "cancella immagine" invece mi cancella la scheda ma non mi fa più vedere il link per cancellare la relativa immagine associata!!!
Questa operazione non posso farla fare prima perchè se non mi cancella prima la scheda_tecnica non mi fa ovviamente cancellare l'immagine associata!!!
Invio sotto la pagina con il codice!
Potete aiutarmi a capire dove sbaglio!
Grazie mille!!!
(sono alle prime armi!)
Alex
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
MM_abortEdit = false
MM_editQuery = ""
%>
<%
if (CStr(Request("MM_delete")) = "form2" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_database_STRING
MM_editTable = "scheda_tecnica"
MM_editColumn = "id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "cancellarticolo.asp"
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then
MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim schede_tech
Dim schede_tech_numRows
Set schede_tech = Server.CreateObject("ADODB.Recordset")
schede_tech.ActiveConnection = MM_database_STRING
schede_tech.Source = "SELECT * FROM scheda_tecnica ORDER BY titolo ASC"
schede_tech.CursorType = 0
schede_tech.CursorLocation = 2
schede_tech.LockType = 1
schede_tech.Open()
schede_tech_numRows = 0
%>
<%
Dim del_scheda_tech__MMColParam
del_scheda_tech__MMColParam = "1"
If (Request.Form("id") <> "") Then
del_scheda_tech__MMColParam = Request.Form("id")
End If
%>
<%
Dim del_scheda_tech
Dim del_scheda_tech_numRows
Set del_scheda_tech = Server.CreateObject("ADODB.Recordset")
del_scheda_tech.ActiveConnection = MM_database_STRING
del_scheda_tech.Source = "SELECT * FROM scheda_tecnica WHERE id = " + Replace(del_scheda_tech__MMColParam, "'", "''") + " ORDER BY titolo ASC"
del_scheda_tech.CursorType = 0
del_scheda_tech.CursorLocation = 2
del_scheda_tech.LockType = 1
del_scheda_tech.Open()
del_scheda_tech_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
del_scheda_tech_numRows = del_scheda_tech_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Cancella Articolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<form name="form1" method="post" action="">
<div align="center"><table width="400" height="30" border="0" cellspacing="0" cellpadding="0">
<tr><td width="400" height="30" class="testipic"><div align="center"><select name="id" id="id" class="testipic">
<option class="testipic" value="1">Scheda articolo ...</option>
<%
While (NOT schede_tech.EOF)
%>
<option class="testipic" value="<%=(schede_tech.Fields.Item("id").Value)%>" ><%=(schede_tech.Fields.Item("titolo").Value)%></option>
<%
schede_tech.MoveNext()
Wend
If (schede_tech.CursorType > 0) Then
schede_tech.MoveFirst
Else
schede_tech.Requery
End If
%>
</select>
<input type="submit" name="Submit" class="testipic" value="Cerca scheda articolo"></div></td></tr>
</table></div></form>
<%
While ((Repeat1__numRows <> 0) AND (NOT del_scheda_tech.EOF))
%>
<form name="form2" method="POST" action="<%=MM_editAction%>">
<div align="center"><table width="400" height="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="400" height="20" class="titoli">TITOLO:<font class="testi"><%=(del_scheda_tech.Fields.Item("tit olo").Value)%></font></td>
</tr>
<tr>
<td width="400" height="20" class="titoli">Descrizione:<font class="testi"><%=(del_scheda_tech.Fields.Item("des crizione").Value)%></font></td>
</tr>
<tr>
<td width="400" height="20" class="titoli">Caratteristiche:<font class="testi"><%=(del_scheda_tech.Fields.Item("car atteristiche").Value)%></font></td>
</tr>
<tr>
<td width="400" height="50" class="testipic"><input class="testipic" type="submit" name="Submit2" value="Cancella scheda articolo"></td>
</tr>
<tr>
<td width="400" height="20" class="testi1"> Ricordati di rimuovere anche
le immagini inutilizzate!</td>
</tr>
<tr>
<td width="400" height="40" class="menu"><a class="menu" href="cancellaimgpic.asp?id_files=<%=(del_scheda_t ech.Fields.Item("id_files").Value)%>" target="_blank">Cancella
immagine piccola</a>
<a class="menu" href="cancellaimgra.asp?id_filesHi=<%=(del_scheda_ tech.Fields.Item("id_filesHi").Value)%>" target="_blank">Cancella
immagine grande</a></td>
</tr>
<tr>
<td width="400" height="15" class="menu">
<input type="hidden" name="MM_delete" value="form2">
<input type="hidden" name="MM_recordId" value="<%= del_scheda_tech.Fields.Item("id").Value %>"></td></tr>
</table></div></form>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
del_scheda_tech.MoveNext()
Wend
%>
</div>
</body>
</html>
<%
schede_tech.Close()
Set schede_tech = Nothing
%>
<%
del_scheda_tech.Close()
Set del_scheda_tech = Nothing
%>

Rispondi quotando