Visualizzazione dei risultati da 1 a 2 su 2

Discussione: cancellazione

  1. #1

    cancellazione

    ciao a tutti

    vorrei un piacere,

    nel database ci sono due tabelle

    1)Utente

    2)Voti

    con la stessa colonna nickname


    vorrei cancellare il nickname in queste due tabelle ,

    come posso fare?

    <%
    ' *** Delete Record: declare variables

    if (CStr(Request("MM_delete")) = "Cancella" And CStr(Request("MM_recordId")) <> "") Then

    MM_editConnection = MM_Database_STRING
    MM_editTable = "Utente"
    MM_editColumn = "nickname"
    MM_recordId = "'" + Request.Form("MM_recordId") + "'"
    MM_editRedirectUrl = "../index.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
    %>
    <%
    ' *** 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
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>

    ciao a tutti

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    nickname = "pippo"
    
    sql = "DELETE FROM Utente WHERE nickname = '"& nickname &"'"
    connessione.Execute(sql)
    
    sql = "DELETE FROM Voti WHERE nickname = '"& nickname &"'"
    connessione.Execute(sql)
    Con DW non ho la più pallida idea di come si faccia.

    Roby

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 © 2026 vBulletin Solutions, Inc. All rights reserved.