Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Problema di apice (apostrofo)

    Tempo fa ho scaricato un file su aruba che ho personalizzato in parte, ho cercato di fare replace per quello che sono le mie conoscenze senza esito.

    Il file serve a modificare tutti i campi di un record access contemporaneamente.

    Mi aiutate?


    '**************************************
    'modificare
    '**************************************


    Sub EditItem()

    which=request("which")
    if isNumeric(which) then
    MySQL="SELECT * FROM " & table_CodAz & " Where " & strKey_10 & " = " & which
    else
    MySQL="SELECT * FROM " & table_CodAz & " Where " & strKey_10 & " = '" & Replace(which,"'","''") & "'"
    end if
    Set MyRs=Connection_Cod.Execute(MySQL)
    Server.Execute("header.asp")

    Response.write ("<div align=""left"" style=""padding:5px""><hr size=""1""><font color=""#FF0000""><p style=""line-height: 150%"">N.b. per poter usare l&#39;apostrofo, devi inserirlo doppio in questa maniera '' il sistema ne fisser&#224; uno solo. Se in modalit&#224; modifica trovi una frase apostrofata, devi riconfermarla con il doppio apostrofo cosi &raquo; '' &laquo; il sistema non accetta doppie virgole &raquo; " &laquo;</font></left><hr size=""1""></font></div>")


    Response.write ("<FORM ACTION=""" & strFile_10 & "?mode=EditItemAction"" METHOD=POST>")
    Response.write ("<input name=""IDAziende"" type=""hidden"" value=""" & MyRs(strKey_10) & """ ""Server.HTMLEncode(corpo)"" >")
    numerocampi=MyRs.fields.count -1
    for i=0 to numerocampi
    if Not MyRs(i).name = "IDAziende" then
    ThisRecord = MyRs(i)
    ThisRecordName = MyRs(i).name
    If IsNull(ThisRecord) or ThisRecord = "" Then
    MyRs(i) = Replace(MyRs(i),"'","''") & "'"
    end if
    Response.write ("<div align=""left"" style=""padding:5px"">" & ThisRecordName & ":</div> ")
    Response.write ("<div align=""left"" style=""padding:5px""><input style=""width:98%"" name=""" & ThisRecordName & """ type=""text"" value=""" & MyRs(i) & """ ""Server.HTMLEncode(corpo)""><br/></div>")
    end if
    next
    Response.write ("<br/><hr><br/><center><INPUT NAME=""Invia"" TYPE=Submit Value=""Aggiorna""></center>")
    Response.write ("</div>")
    Response.write ("</FORM>")
    MyRs.close
    Set MyRs= Nothing
    End Sub
    Sub EditItemAction()
    which = Request(strKey_10)
    if isNumeric(which) then
    MySQL="SELECT * FROM " & table_CodAz & " Where " & strKey_10 & " = " & which
    else
    MySQL="SELECT * FROM " & table_CodAz & " Where " & strKey_10 & " = '" & Replace(which,"'","''") & "'"
    MySQL="SELECT * FROM " & table_CodAz & " REPLACE(which,"'","''") = '" strKey_10 "'"
    end if
    MySQL="Select * from " & table_CodAz
    Set MyRs=Connection_Cod.Execute(MySQL)
    numerocampi=MyRs.fields.count -1
    for i=0 to numerocampi
    if Not MyRs(i).name = "IDAziende" then
    str = MyRs(i).name
    strNames = Request(str)
    if not i = numerocampi then
    str1 = str1 & "[" & str & "] = '" & strNames & "',"
    else
    str1 = str1 & "[" & str & "] = '" & strNames & "'"

    end if
    end if
    next
    MySQL1="UPDATE " & table_CodAz & " SET " & str1 & " Where " & strKey_10 & " = '" & Replace(which,"'","''") & "'"
    Set MyRs1=Connection_Cod.Execute(MySQL1)
    Connection_Cod.Close
    set Connection_Cod=nothing
    Response.Redirect strFile_redirect
    End Sub
    end if


  2. #2
    Quote Originariamente inviata da ALESSANDRO007 Visualizza il messaggio
    Tempo fa ho scaricato un file su aruba che ho personalizzato in parte, ho cercato di fare replace per quello che sono le mie conoscenze senza esito.

    Il file serve a modificare tutti i campi di un record access contemporaneamente.

    Mi aiutate?
    Il problema nasce nelle input quando si popolano i dati, precisamente con l'apice e le doppie virgole.

  3. #3
    non s'è capito quale sia il problema

  4. #4

    replace su apice e doppie virgolette

    Quote Originariamente inviata da optime Visualizza il messaggio
    non s'è capito quale sia il problema
    l problema è su replace, ci dovrebbero essere anche alcuni tentativi non andati a buon fine che ho tentato da buon autodidatta ma senza esito.

    MySQL1="UPDATE " & table_CodAz & " SET " & str1 & " Where " & strKey_10 & " = '" & Replace(which,"'","''") & "'"

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.