Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 19
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2003
    Messaggi
    376

    aiuto per eliminazione di record da mdb

    Ciao a tutti ho questo problema in localhost lo script funziona alla grande e se non ricordo male funzionava anche su web, ma dopo alcune modifiche non funziona più adesso ho perso il filo e sono desperados!!!!!!!!!
    Questo è il codice :
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


    <%
    ' *** Edit Operations: declare variables

    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
    Dim Rep
    Dim alert


    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Request.QueryString
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Delete Record: declare variables

    if (CStr(Request("MM_delete")) = "form3" And CStr(Request("MM_recordId")) <> "") Then
    MM_editConnection = MM_conn_app_STRING
    MM_editTable = "T_Appartamenti"
    MM_editColumn = "Rif"
    MM_recordId = "'" + Request.Form("MM_recordId") + "'"
    MM_editRedirectUrl = "gest_app.asp"

    ' append the query string to the redirect URL
    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
    %>
    <%
    var = CStr(Request("MM_recordId"))
    Dim Recordset3
    Dim Recordset3_numRows

    Set Recordset3 = Server.CreateObject("ADODB.Recordset")
    Recordset3.ActiveConnection = MM_conn_app_STRING
    Recordset3.Source = "SELECT Rif FROM T_Appartamenti WHERE Rif = '" & var &"'"
    Recordset3.CursorType = 0
    Recordset3.CursorLocation = 2
    Recordset3.LockType = 1
    Recordset3.Open()
    Recordset3_numRows = 0

    ' *** Delete Record: construct a sql delete statement and execute it

    If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "" ) Then

    ' create the sql delete statement
    MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId

    If (Not MM_abortEdit) Then
    ' execute the delete
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    'if recordset3.fields.item("Rif").value <>"" then
    'session("Rif")= recordset3.fields.item("Rif").value
    'path=session("Rif")

    'dim FileObject
    'Set FileObject = CreateObject ("Scripting.FileSystemObject")
    'FileObject.DeleteFile (Server.mappath (path))
    'Set FileObject = Nothing
    ' end if

    MM_editCmd.ActiveConnection.Close
    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    Recordset3.Close()
    Set Recordset3 = Nothing
    End If
    end if%>
    <%
    Dim Recordset7
    Dim Recordset7_numRows

    Set Recordset7 = Server.CreateObject("ADODB.Recordset")
    Recordset7.ActiveConnection = MM_conn_app_STRING
    Recordset7.Source = "SELECT Descrizione, Dove, Prezzo, Rif FROM T_Appartamenti ORDER BY Rif DESC"
    Recordset7.CursorType = 0
    Recordset7.CursorLocation = 2
    Recordset7.LockType = 1
    Recordset7.Open()

    Recordset7_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = 10
    Repeat1__index = 0
    Recordset7_numRows = Recordset7_numRows + Repeat1__numRows
    %>
    <%
    ' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

    Dim Recordset7_total
    Dim Recordset7_first
    Dim Recordset7_last

    ' set the record count
    Recordset7_total = Recordset7.RecordCount

    ' set the number of rows displayed on this page
    If (Recordset7_numRows < 0) Then
    Recordset7_numRows = Recordset7_total
    Elseif (Recordset7_numRows = 0) Then
    Recordset7_numRows = 1
    End If

    ' set the first and last displayed record
    Recordset7_first = 1
    Recordset7_last = Recordset7_first + Recordset7_numRows - 1

    ' if we have the correct record count, check the other stats
    If (Recordset7_total <> -1) Then
    If (Recordset7_first > Recordset7_total) Then
    Recordset7_first = Recordset7_total
    End If
    If (Recordset7_last > Recordset7_total) Then
    Recordset7_last = Recordset7_total
    End If
    If (Recordset7_numRows > Recordset7_total) Then
    Recordset7_numRows = Recordset7_total
    End If
    End If
    %>
    <%
    ' *** Recordset Stats: if we don't know the record count, manually count them

    If (Recordset7_total = -1) Then

    ' count the total records by iterating through the recordset
    Recordset7_total=0
    While (Not Recordset7.EOF)
    Recordset7_total = Recordset7_total + 1
    Recordset7.MoveNext
    Wend

    ' reset the cursor to the beginning
    If (Recordset7.CursorType > 0) Then
    Recordset7.MoveFirst
    Else
    Recordset7.Requery
    End If

    ' set the number of rows displayed on this page
    If (Recordset7_numRows < 0 Or Recordset7_numRows > Recordset7_total) Then
    Recordset7_numRows = Recordset7_total
    End If

    ' set the first and last displayed record
    Recordset7_first = 1
    Recordset7_last = Recordset7_first + Recordset7_numRows - 1

    If (Recordset7_first > Recordset7_total) Then
    Recordset7_first = Recordset7_total
    End If
    If (Recordset7_last > Recordset7_total) Then
    Recordset7_last = Recordset7_total
    End If

    End If
    %>
    <%
    Dim MM_paramName
    %>

    <%
    ' *** Move To Record and Go To Record: declare variables

    Dim MM_rs
    Dim MM_rsCount
    Dim MM_size
    Dim MM_uniqueCol
    Dim MM_offset
    Dim MM_atTotal
    Dim MM_paramIsDefined

    Dim MM_param
    Dim MM_index

    Set MM_rs = Recordset7
    MM_rsCount = Recordset7_total
    MM_size = Recordset7_numRows
    MM_uniqueCol = ""
    MM_paramName = ""
    MM_offset = 0
    MM_atTotal = false
    MM_paramIsDefined = false
    If (MM_paramName <> "") Then
    MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
    End If
    %>
    <%
    ' *** Move To Record: handle 'index' or 'offset' parameter

    if (Not MM_paramIsDefined And MM_rsCount <> 0) then

    ' use index parameter if defined, otherwise use offset parameter
    MM_param = Request.QueryString("index")
    If (MM_param = "") Then
    MM_param = Request.QueryString("offset")
    End If
    If (MM_param <> "") Then
    MM_offset = Int(MM_param)
    End If

    ' if we have a record count, check if we are past the end of the recordset
    If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
    If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
    MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
    Else
    MM_offset = MM_rsCount - MM_size
    End If
    End If
    End If

    ' move the cursor to the selected record
    MM_index = 0
    While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    MM_index = MM_index + 1
    Wend
    If (MM_rs.EOF) Then
    MM_offset = MM_index ' set MM_offset to the last possible record
    End If

    End If
    %>

    <html>
    <head>
    <title>Gestione Prodotti</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <style type="text/css">
    <!--
    @import url("shop.css");
    -->
    </style>
    </head>
    <body onLoad="<%= alert %>" bgcolor="#FFFFCC">

    <table width="100%" align="center">

    <div align="left">
    <%
    While ((Repeat1__numRows <> 0) AND (NOT Recordset7.EOF))
    %>
    <table width="100%" align="center">
    <tr>
    <td width="8%" nowrap><font color="#990000">Riferimento</font>
    <td width="7%" nowrap><font color="#990000">Ubicazione </font>
    <td width="36%" nowrap><font color="#990000">Descrizione</font>
    <td width="12%" nowrap><font color="#990000">Prezzo</font>
    <tr>
    <td colspan="6" valign="top" nowrap> <form action="<%=MM_editAction%>" method="POST" name="form2">



    <input name="textfield1" size="6" type="text" value="<%=(Recordset7.Fields.Item("RIf").Value)%>" >
    <input name="textfield2" size="14" type="text" value="<%=(Recordset7.Fields.Item("Dove").Value)%> ">
    <textarea name="textarea" cols="70" rows="3" ><%=(Recordset7.Fields.Item("Descrizione").Value)% ></textarea>
    <input name="textfield3" size="12" type="text" value="<%=(Recordset7.Fields.Item("Prezzo").Value) %>">
    <input name="Submit2" type="submit" class="invio" value="Modifica">
    <input type="hidden" name="MM_update" value="form2">
    <input type="hidden" name="MM_recordId" value="<%= Recordset7.Fields.Item("RIf").Value %>">
    </p>
    </form>
    <td width="10%" valign="bottom" nowrap> <form action="<%=MM_editAction%>" method="POST" name="form3">
    <input type="hidden" name="MM_delete" value="form3">
    <input name="invia" type="submit" class="invio" id="invia" value="Elimina">
    <input type="hidden" name="MM_recordId" value="<%= Recordset7.Fields.Item("Rif").Value %>">
    </form></td>
    </tr>
    </table>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Recordset7.MoveNext()
    Wend
    %>
    <table width="70%" align="center">
    <tr>
    <td width="24%"><table border="0" width="75%" align="left">
    <tr>
    <td width="23%" align="center">
    <% If MM_offset <> 0 Then %>
    [img]images/First.gif[/img]
    <% End If ' end MM_offset <> 0 %>
    </td>
    <td width="31%" align="center">
    <% If MM_offset <> 0 Then %>
    [img]images/Previous.gif[/img]
    <% End If ' end MM_offset <> 0 %>
    </td>
    <td width="23%" align="center">
    <% If Not MM_atTotal Then %>
    [img]images/Next.gif[/img]
    <% End If ' end Not MM_atTotal %>
    </td>
    <td width="23%" align="center">
    <% If Not MM_atTotal Then %>
    [img]images/Last.gif[/img]
    <% End If ' end Not MM_atTotal %>
    </td>
    </tr>
    </table></td>
    <td width="76%"></td>
    </tr>
    <tr>
    <td colspan="2"><div align="center"><font color="#990000" size="2">Dal
    n&deg; <%=(Recordset7_first)%> al
    n&deg;<%=(Recordset7_last)%>

    su un tot di <%=(Recordset7_total)%> </font></div></td>
    </tr>
    </table>
    </div>

    </body>
    </html>

    <%
    Recordset7.Close()
    Set Recordset7 = Nothing
    %>
    Chi Crede in Me non Perirà MAI

  2. #2
    Sempre detto io che modificare codice generato in automatico da qualche fantomatico programma "all-in-one" è cosa ardua...
    Così come è arduo ora anche solo leggere il tuo codice.
    Mannagg....

  3. #3
    cancella tutto e rifai tutto da capo...questo lo scotto degli script preconfezionati dalle macchine


    oppure ci provi a dire qual'è l'errore che adesso si verifica e DOVE (se in locale/server e a quale riga del codice) si verifica

  4. #4
    Originariamente inviato da santino83_11_04
    cancella tutto e rifai tutto da capo...questo lo scotto degli script preconfezionati dalle macchine
    E chi dice alle macchine come scrivere il codice?
    Sempre uno (o più) programmatori. In questo caso forse poco adepti al problema.

  5. #5
    Originariamente inviato da Dirk Pitt
    E chi dice alle macchine come scrivere il codice?
    Sempre uno (o più) programmatori. In questo caso forse poco adepti al problema.

    in realtà lo script che genera DW è estremamente solido, se però non deve subire variazioni particolari...in quel caso si rischia di sballare tutto...e cmq uno perde piu tempo a modificare quello script che a farselo per cono proprio

  6. #6

  7. #7
    Utente di HTML.it
    Registrato dal
    Sep 2003
    Messaggi
    376
    il problema è sicuramente a livello server e non il colahost perchè in locale funziona.
    L'errore che si presenta è il seguente in fase di delete mi dice che :
    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] Could not delete from specified tables.

    /gest_app.asp, line 231
    la riga incriminata è quella di exeute dopo che ha aperto la connection

    grazie
    Chi Crede in Me non Perirà MAI

  8. #8
    ma un insert lo fa? oppure riesci solo a LEGGERE dal db e a non fare altro?


    EDIT: mi spiego meglio...prova a inserire via codice qualcosa nel db e vedi se va

  9. #9
    Che non abbia i permessi in scrittura? :rollo:

  10. #10
    Utente di HTML.it
    Registrato dal
    Sep 2003
    Messaggi
    376
    infatti era quello che temevo anche io perchè non fa ne l'insert ne la delete ma proma di quella pagina esiste una login.ap che va a cercar sia l'account che la password sul db e questa pagina funziona benissimo
    ditemi come posso fare a inserire qualcosa via codice
    grazie
    Chi Crede in Me non Perirà MAI

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.