Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2010
    Messaggi
    4

    Database O Io Sono Idiota?

    ciao a tutti sono nuovo ho costruito grazie a vari script e notti insonne ,un 'efficente programma newsletter per adattarlo su servizi aruba (con timer delay etc)
    comunque sto impazzendo a creare un sistema che
    mi controlli un semplice array dove da form gli trasmetto alcuni indirizzi email da cancellare nel
    database
    quindi poi in automatico cancelli gli indirizzi che non mi servono in un colpo solo

    ho provato con questa query funziona ma se ce un indirizzo doppio mi cancella solo il primo
    e mi lascia nel database ACCESS su server ARUBA la copia dell'indirizzo che in teoria dovrebbe cancellarli entrambi visto che gli faccio fare il loop if not .eof

    risultato alcuni indirizzi vengono cancellati altri con doppi rimangono nel record db

    Spero di essermi fatto capire da qualcuno e che possa risolvere il problema

    COME FUNZIONA :
    procedura da form inserisco indirizzi emails da cancellare ---> vengono ricevuti da un'array
    che lo splitta , mi conta le righe etc --->l'array sposta le righe una ad una (record)
    poi il viene trasmesso il tutto nel DB , una volta finito di leggere l'array (1) (se l'email esiste)
    dopo la cancellazione incrementa di una riga la lettura dell'array in ciclo stesso for next . fino all'ultimo record
    risultato vengono cancellati tutti record ma se ce un record doppio ovvero un'email registrata due o tre volte per errore mi cancella solo il primo record ... la cosa strana e anche che se tento di rimettere l'utente (email) 1° che ho appena cancellato il database lo accetta e lo attiva nel database
    ma se lo cancello un'altra volta me lo rimette nel database assieme al vecchio doppione
    boh sto andando fuori di testa
    perfavore datemi una mano


    PAGINA DI CANCELLAZIONE AUTOMATICA ASP UTENTI DA CANCELLARE DA LISTA FORM
    ================================================== =========================
    <%@LANGUAGE = VBScript%>






    <html>
    <HEAD>

    <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="text/javascript">
    <!-- Begin

    function copy() {
    textRange = document.extractor.output.createTextRange();
    textRange.execCommand("RemoveFormat");
    textRange.execCommand("Copy");
    }
    function paste() {
    textRange = document.extractor.input.createTextRange();
    textRange.execCommand("RemoveFormat");
    textRange.execCommand("Paste");
    }
    function findEmail() {
    var email = "No email address detected";
    var a = 0;
    var ingroup = 0;
    var separator = "new";
    var string = "";
    var groupby = "";

    if (separator == "new") separator = "\n";
    if (separator == "other") separator = document.extractor.othersep.value;
    var rawemail = document.extractor.input.value.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
    var norepeat = new Array();
    var filtermail = new Array();
    if (rawemail) {
    if (string){
    x = 0;
    for (var y=0; y<rawemail.length; y++) {
    if (rawemail[y].search(string) >= 0) {
    filtermail[x] = rawemail[y];
    x++;
    }
    }
    rawemail = filtermail;
    }

    for (var i=0; i<rawemail.length; i++) {
    var repeat = 0;

    // Check for repeated emails routine
    for (var j=i+1; j<rawemail.length; j++) {
    if (rawemail[i] == rawemail[j]) {
    repeat++;
    }
    }

    // Create new array for non-repeated emails
    if (repeat == 0) {
    norepeat[a] = rawemail[i];
    a++;
    }
    }
    if (document.extractor.sort.checked) norepeat = norepeat.sort(); // Sort the array
    email = "";
    // Join emails together with separator
    for (var k = 0; k < norepeat.length; k++) {
    if (ingroup != 0) email += separator;
    // aggiunta virgola segno
    email += ","+ norepeat[k];
    ingroup++;


    }
    }

    script1() ;
    // Return array length
    var count = norepeat.length;

    // Print results
    document.extractor.count.value = count;
    document.extractor.output.value = email;
    }
    // End -->
    </SCRIPT>

    <script>

    function script1() {
    var e = document.getElementById("exporta");
    e.innerHTML = '<input type="submit" class="button" value="exporta il testo">'
    }
    </script>
    <STYLE TYPE="text/css">

    BODY,td,th,ul,p { font: normal normal normal 8pt/1em Verdana; color: #000; }
    textarea,input,select { font: normal normal normal 8pt/1em Verdana; color: #000; }


    .bordercolor { background:#666 }
    .maincolor { background:#CCC }
    .button { background:#CCC }
    .titlebarcolor { background:#007 }
    .titlefont { font: normal normal bold 9pt/1em Arial; color: #FFF; }

    </STYLE>
    </HEAD>
    <BODY>


    <form method="post" name="extractor" action="importadatesto.asp?elabora=salva" method=""post"">
    <DIV ALIGN="CENTER">
    <TR><TD>
    <TABLE CLASS="maincolor" CELLPADDING=4 CELLSPACING=0 BORDER=0>
    <TR>
    <TD VALIGN="TOP" ALIGN="CENTER" WIDTH="50%">
    <TEXTAREA NAME="input" rows=8 cols=50 onBlur="findEmail();"></TEXTAREA>
    </TD>
    <TD VALIGN="TOP" ALIGN="CENTER" WIDTH="50%">

    <TEXTAREA NAME="output" rows=8 cols=50 ></TEXTAREA>

    </TD></TR>
    <TR>
    <TD VALIGN="TOP" ALIGN="CENTER">
    </TD>
    <TD VALIGN="TOP" ALIGN="CENTER">
    </TD></TR>
    <TR>
    <TD VALIGN="TOP" ALIGN="LEFT" COLSPAN=2>
    <INPUT TYPE="hidden" NAME="sort" id="sortbox">
    </TD></TR>
    <TR>
    <TD VALIGN="TOP" ALIGN="LEFT" COLSPAN=2>
    <div ALIGN="CENTER" id=exporta></DIV>
    </TD>
    </TR>

    <TR>
    <td>
    <INPUT TYPE="RESET" CLASS="button" VALUE="Reset">
    <INPUT NAME="count" SIZE=5 READONLY>
    </TD>
    </TR>
    </FORM>

    <tr>
    <td >
    <form name="file_upload" method="post" ENCTYPE="multipart/form-data" Action=" salva_allegati.asp?testodata=si">
    <input type="file" size="20" name="Filename" class=button>
    </td>


    <tr>
    <td>
    <input type="hidden" name="uppo" value="update">
    <input type="submit" class="button" value="salva nel db il file">
    </td>
    </tr>
    </table>
    </form>
    <%

    ConnectDB()
    connectrst()

    'Global variables
    Dim lngTotalProcessed 'Counts the number of records processed




    '******************************************
    '*** Import form CSV file ****
    '******************************************

    Public Sub GetCsvSubscribers()



    'Initilise variables
    lngMemberImportCount = 0
    lngMemberAlreadyImported = 0
    lngMemberNoEmail = 0
    lngTotalProcessed = 0
    blnEmailOK = True
    blnEmailExists = false


    '########################



    'conto le linee
    sarryCsvFile = Split(Request.Form("output") , Chr(10))


    'ottengo il numero di righe
    lngTotalRecords = UBound(sarryCsvFile) + 1

    'contatore
    Response.Write("<script language=""JavaScript"">" & _

    vbCrLf & " document.getElementById('subscribers').innerHTML = '" & lngTotalRecords & "';" & _
    vbCrLf & "</script>")



    'Loop through recordset
    For lngCsvFileLoopCounter = 0 To (lngTotalRecords - 1)

    'Initilise variables
    blnEmailOK = True
    blnEmailExists = false
    strEmail = ""
    strName = ""


    'Count the number of files processed
    lngTotalProcessed = lngTotalProcessed + 1

    'Check to see if there is a comma before reading in data
    If InStr(sarryCsvFile(lngCsvFileLoopCounter), ",") Then

    'Read in the CSV file line into an array
    sarryCsvFileLine = Split(sarryCsvFile(lngCsvFileLoopCounter),"," )


    'Read in the details from the file
    strName = sarryCsvFileLine(0)
    If strName <> "" Then strName = strName
    strEmail = LCase(sarryCsvFileLine(1))
    If strEmail <> "" Then strEmail = Trim(strEmail)
    End If


    'If no email address for user display message
    If strEmail = "" Then

    lngMemberNoEmail = lngMemberNoEmail + 1

    end if

    '####### QUESTa query da i numeri !!! #### '


    strSQL = "SELECT * FROM subscriber_list WHERE Email = '" &strEmail& "'"

    With adorst

    .CursorType = 3
    .LockType = 3
    .Open strSQL, adoCon


    If NOT .EOF Then
    blnEmailExists = true

    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "

    .delete
    .movenext


    ' incremento
    lngMemberAlreadyImported = lngMemberAlreadyImported + 1



    end if


    ' questa opzione posso anche toglierla
    ' serve per updatare il database con nuovi utenti

    'If the email doesn't already exsist then enter the email into the database
    If blnEmailExists = False Then

    response.write "<font color=gree>[b]INSERITO: "&strEmail&"</font>"

    'Add new record to a new recorset
    .AddNew

    'Set database fields
    .Fields("Email") = Trim(Mid(strEmail, 1, 50))
    if strName<>"" then
    .Fields("name") = Trim(Mid(strname, 1, 50))
    else
    .Fields("name") = Trim(Mid(strEmail, 1, 50))
    end if
    .Fields("active") = "true"
    .Fields("status") = "1"
    .Fields("sub_date") = date()
    .Update

    .Requery

    End If

    .Close
    End With

    '############################fino a qua ###############################'



    'Display on page number of subscribers to import
    Response.Write(vbCrLf & "<script language=""JavaScript"">"& _
    vbCrLf & " document.getElementById('imported').innerHTML = '" & lngMemberImportCount & "';" & _
    vbCrLf & " document.getElementById('done').innerHTML = '" & lngMemberAlreadyImported & "';" & _
    vbCrLf & " document.getElementById('noemail').innerHTML = '" & lngMemberNoEmail & "';" & _
    vbCrLf & " document.getElementById('total').innerHTML = '" & lngTotalProcessed & "';" & _
    vbCrLf & " document.getElementById('progress').innerHTML = '" & percentageCalculate(lngTotalProcessed, lngTotalRecords, 0) & "';" & _
    vbCrLf & " document.getElementById('bar').style.width = '" & percentageCalculate(lngTotalProcessed, lngTotalRecords, 0) & "';" & _
    vbCrLf & "</script>")


    Next
    Set adorst = Nothing
    Set adocon = Nothing
    End Sub

    '******************************************
    '*** Calculate Percentage ****
    '******************************************

    Private Function percentageCalculate(ByRef lngNumberProcessed, ByRef lngTotalToProcess, ByRef intDecPlaces)

    'If there are no newsletters sent yet then format the percent by 0 otherwise an overflow error will happen
    If lngTotalProcessed = 0 Then
    percentageCalculate = FormatPercent(1, 1)

    'Else read in the the percentage of newsletters sent
    Else
    percentageCalculate = FormatPercent((lngNumberProcessed / lngTotalToProcess), intDecPlaces)
    End If

    End Function

    %>
    <tr>
    <table border="0" width=640 align=center>
    <td id="bar" bgcolor=lightgreen style="width:100%;"></td>
    <td id="progress" bgcolor=red ></td>
    </tr>
    </table>
    <tr>
    <table width=640 align=center border=0 cellspacing=0 cellpadding=0>
    <tr>
    <td>Campi trovati</td><td id="subscribers"></td>
    <td>Campi vuoti</td><td id="noemail"></td>
    <td>Campi già importati</td><td id="done"></td>
    <td>Processati</td><td id="total"></td>
    <td>Campi inseriti</td><td id="imported"><td>

    </tr>
    </table>
    </body>
    <%
    Call GetCsvSubscribers()
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Fatti stampare a video quella query così verifichi.
    Ad ogni modo invece di fare la SELECT e poi aprire il recordset e cancellare la riga ti conviene fare semplimente:
    codice:
    strSQL = "DELETE FROM subscriber_list WHERE Email = '" &strEmail& "'"
    adoCon.Execute(strSQL)

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2010
    Messaggi
    4

    ciao ti ringrazio ma non funge

    Tieni presente che ho fatto pure un test in questo modo :
    [...] strEmail= array1(x)

    '####### QUESTa query da i numeri !!! #### '


    strSQL = "DELETE * FROM subscriber_list WHERE Email = '" &strEmail& "'"

    adoCon.Execute(strSQL)
    Response.Write(strSQL)

    With adorst

    .CursorType = 3
    .LockType = 3
    .Open strSQL, adoCon


    If NOT .EOF Then
    blnEmailExists = true

    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "



    end if
    next
    -------------------------------------------------------------------------------------
    risultato query tua: DELETE * FROM subscriber_list WHERE Email = 'aaron@socialsignal.com'
    ================================================== ===================
    ma non cancella nulla






    il succo è questo:
    strEmail=(array test)(x)


    '####### QUESTa query da i numeri !!! #### '


    strSQL = "SELECT * FROM subscriber_list WHERE Email = '" &strEmail& "'"

    With adorst

    .CursorType = 3
    .LockType = 3
    .Open strSQL, adoCon


    If NOT .EOF Then
    blnEmailExists = true

    response.write "<font color=yellow >[b]"&strEmail&"cancellato ->"& .fields("email")& "</font>
    "

    .delete

    Response.Write(strSQL)
    .movenext


    ' incremento
    lngMemberAlreadyImported = lngMemberAlreadyImported + 1



    end if


    ' questa opzione posso anche toglierla
    ' serve per updatare il database con nuovi utenti

    'If the email doesn't already exsist then enter the email into the database
    If blnEmailExists = False Then

    response.write "<font color=gree>[b]INSERITO: "&strEmail&"</font>"

    'Add new record to a new recorset
    .AddNew

    'Set database fields
    .Fields("Email") = Trim(Mid(strEmail, 1, 50))
    if strName<>"" then
    .Fields("name") = Trim(Mid(strname, 1, 50))
    else
    .Fields("name") = Trim(Mid(strEmail, 1, 50))
    end if
    .Fields("active") = "true"
    .Fields("status") = "1"
    .Fields("sub_date") = date()
    .Update

    .Requery

    End If

    .Close
    End With
    next
    [chiusura connessioni]
    ---------------------------------------------------------------------
    RISULTATO mia
    R.W: mi dice: cancellato ->aaron@socialsignal.com
    R.W QUERY select * FROM subscriber_list WHERE Email = 'aaron@socialsignal.com'

    (ma mi cancella solo un aaron@socialsignal.com invece di tre che ho aggiunto apposta)
    poi lo rimetto nell'array( form) e lo reinserisce in UPDATE
    al posto di cancellarlo ...boh

    POI NON CAPISCO PERKE ARUBA NON ACCETTA IL PARAMETRO DISTINCT ..uffa

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Cosa c'entra ARUBA?
    La distinct la fai sul db...
    Usi Access?

    Ma il tuo obiettivo è cancellare le email oppure di inserirle?
    Se le devi solo cancellare il recordset non ti serve.

    Roby

  5. #5
    Utente di HTML.it
    Registrato dal
    Dec 2010
    Messaggi
    4

    ciao

    riguardo alla distinct era solo una mia curiosità
    in quanto ho letto che per evitare d leggere i doppioni in teoria dovrei usare il distinct
    ma non mi funziona su access MDB su aruba

    mentre tu mi dici che per cancellare in loop non serve il record set?

    scusa mi faresti vedere (se hai voglia)

    IL SISTEMA SENZA RECORDSET PER CANCELLARE IL DOPPIONI
    DAL DATABASE?

    TIPO DELETE * FROM TABELLA WHERE EMAIL = (ARRAY)(X)
    NON SERVONO CURSORI?
    NON SERVE IL LOOP? neanche un ciclo for?

    .close


    Guarda che io uilizzo un semplice database access 2000 sul server ASP

    e penso che alcune funzioni come count distinct non le accetti

    Dinuovo Grazie per la risposta

  6. #6
    Utente di HTML.it L'avatar di vic53
    Registrato dal
    Oct 2010
    residenza
    Fonte Nuova (Roma)
    Messaggi
    592

    Re: Database O Io Sono Idiota?

    Originariamente inviato da bromuro
    ciao a tutti sono nuovo ho costruito grazie a vari script e notti insonne ,un 'efficente programma newsletter per adattarlo su servizi aruba (con timer delay etc)
    comunque sto impazzendo a creare un sistema che
    mi controlli un semplice array dove da form gli trasmetto alcuni indirizzi email da cancellare nel
    database
    quindi poi in automatico cancelli gli indirizzi che non mi servono in un colpo solo

    ho provato con questa query funziona ma se ce un indirizzo doppio mi cancella solo il primo
    e mi lascia nel database ACCESS su server ARUBA la copia dell'indirizzo che in teoria dovrebbe cancellarli entrambi visto che gli faccio fare il loop if not .eof

    risultato alcuni indirizzi vengono cancellati altri con doppi rimangono nel record db

    Spero di essermi fatto capire da qualcuno e che possa risolvere il problema

    COME FUNZIONA :
    procedura da form inserisco indirizzi emails da cancellare ---> vengono ricevuti da un'array
    che lo splitta , mi conta le righe etc --->l'array sposta le righe una ad una (record)
    poi il viene trasmesso il tutto nel DB , una volta finito di leggere l'array (1) (se l'email esiste)
    dopo la cancellazione incrementa di una riga la lettura dell'array in ciclo stesso for next . fino all'ultimo record
    risultato vengono cancellati tutti record ma se ce un record doppio ovvero un'email registrata due o tre volte per errore mi cancella solo il primo record ... la cosa strana e anche che se tento di rimettere l'utente (email) 1° che ho appena cancellato il database lo accetta e lo attiva nel database
    ma se lo cancello un'altra volta me lo rimette nel database assieme al vecchio doppione
    boh sto andando fuori di testa
    perfavore datemi una mano


    PAGINA DI CANCELLAZIONE AUTOMATICA ASP UTENTI DA CANCELLARE DA LISTA FORM
    ================================================== =========================
    <%@LANGUAGE = VBScript%>






    <html>
    <HEAD>

    <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="text/javascript">
    <!-- Begin

    function copy() {
    textRange = document.extractor.output.createTextRange();
    textRange.execCommand("RemoveFormat");
    textRange.execCommand("Copy");
    }
    function paste() {
    textRange = document.extractor.input.createTextRange();
    textRange.execCommand("RemoveFormat");
    textRange.execCommand("Paste");
    }
    function findEmail() {
    var email = "No email address detected";
    var a = 0;
    var ingroup = 0;
    var separator = "new";
    var string = "";
    var groupby = "";

    if (separator == "new") separator = "\n";
    if (separator == "other") separator = document.extractor.othersep.value;
    var rawemail = document.extractor.input.value.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
    var norepeat = new Array();
    var filtermail = new Array();
    if (rawemail) {
    if (string){
    x = 0;
    for (var y=0; y<rawemail.length; y++) {
    if (rawemail[y].search(string) >= 0) {
    filtermail[x] = rawemail[y];
    x++;
    }
    }
    rawemail = filtermail;
    }

    for (var i=0; i<rawemail.length; i++) {
    var repeat = 0;

    // Check for repeated emails routine
    for (var j=i+1; j<rawemail.length; j++) {
    if (rawemail[i] == rawemail[j]) {
    repeat++;
    }
    }

    // Create new array for non-repeated emails
    if (repeat == 0) {
    norepeat[a] = rawemail[i];
    a++;
    }
    }
    if (document.extractor.sort.checked) norepeat = norepeat.sort(); // Sort the array
    email = "";
    // Join emails together with separator
    for (var k = 0; k < norepeat.length; k++) {
    if (ingroup != 0) email += separator;
    // aggiunta virgola segno
    email += ","+ norepeat[k];
    ingroup++;


    }
    }

    script1() ;
    // Return array length
    var count = norepeat.length;

    // Print results
    document.extractor.count.value = count;
    document.extractor.output.value = email;
    }
    // End -->
    </SCRIPT>

    <script>

    function script1() {
    var e = document.getElementById("exporta");
    e.innerHTML = '<input type="submit" class="button" value="exporta il testo">'
    }
    </script>
    <STYLE TYPE="text/css">

    BODY,td,th,ul,p { font: normal normal normal 8pt/1em Verdana; color: #000; }
    textarea,input,select { font: normal normal normal 8pt/1em Verdana; color: #000; }


    .bordercolor { background:#666 }
    .maincolor { background:#CCC }
    .button { background:#CCC }
    .titlebarcolor { background:#007 }
    .titlefont { font: normal normal bold 9pt/1em Arial; color: #FFF; }

    </STYLE>
    </HEAD>
    <BODY>


    <form method="post" name="extractor" action="importadatesto.asp?elabora=salva" method=""post"">
    <DIV ALIGN="CENTER">
    <TR><TD>
    <TABLE CLASS="maincolor" CELLPADDING=4 CELLSPACING=0 BORDER=0>
    <TR>
    <TD VALIGN="TOP" ALIGN="CENTER" WIDTH="50%">
    <TEXTAREA NAME="input" rows=8 cols=50 onBlur="findEmail();"></TEXTAREA>
    </TD>
    <TD VALIGN="TOP" ALIGN="CENTER" WIDTH="50%">

    <TEXTAREA NAME="output" rows=8 cols=50 ></TEXTAREA>

    </TD></TR>
    <TR>
    <TD VALIGN="TOP" ALIGN="CENTER">
    </TD>
    <TD VALIGN="TOP" ALIGN="CENTER">
    </TD></TR>
    <TR>
    <TD VALIGN="TOP" ALIGN="LEFT" COLSPAN=2>
    <INPUT TYPE="hidden" NAME="sort" id="sortbox">
    </TD></TR>
    <TR>
    <TD VALIGN="TOP" ALIGN="LEFT" COLSPAN=2>
    <div ALIGN="CENTER" id=exporta></DIV>
    </TD>
    </TR>

    <TR>
    <td>
    <INPUT TYPE="RESET" CLASS="button" VALUE="Reset">
    <INPUT NAME="count" SIZE=5 READONLY>
    </TD>
    </TR>
    </FORM>

    <tr>
    <td >
    <form name="file_upload" method="post" ENCTYPE="multipart/form-data" Action=" salva_allegati.asp?testodata=si">
    <input type="file" size="20" name="Filename" class=button>
    </td>


    <tr>
    <td>
    <input type="hidden" name="uppo" value="update">
    <input type="submit" class="button" value="salva nel db il file">
    </td>
    </tr>
    </table>
    </form>
    <%

    ConnectDB()
    connectrst()

    'Global variables
    Dim lngTotalProcessed 'Counts the number of records processed




    '******************************************
    '*** Import form CSV file ****
    '******************************************

    Public Sub GetCsvSubscribers()



    'Initilise variables
    lngMemberImportCount = 0
    lngMemberAlreadyImported = 0
    lngMemberNoEmail = 0
    lngTotalProcessed = 0
    blnEmailOK = True
    blnEmailExists = false


    '########################



    'conto le linee
    sarryCsvFile = Split(Request.Form("output") , Chr(10))


    'ottengo il numero di righe
    lngTotalRecords = UBound(sarryCsvFile) + 1

    'contatore
    Response.Write("<script language=""JavaScript"">" & _

    vbCrLf & " document.getElementById('subscribers').innerHTML = '" & lngTotalRecords & "';" & _
    vbCrLf & "</script>")



    'Loop through recordset
    For lngCsvFileLoopCounter = 0 To (lngTotalRecords - 1)

    'Initilise variables
    blnEmailOK = True
    blnEmailExists = false
    strEmail = ""
    strName = ""


    'Count the number of files processed
    lngTotalProcessed = lngTotalProcessed + 1

    'Check to see if there is a comma before reading in data
    If InStr(sarryCsvFile(lngCsvFileLoopCounter), ",") Then

    'Read in the CSV file line into an array
    sarryCsvFileLine = Split(sarryCsvFile(lngCsvFileLoopCounter),"," )


    'Read in the details from the file
    strName = sarryCsvFileLine(0)
    If strName <> "" Then strName = strName
    strEmail = LCase(sarryCsvFileLine(1))
    If strEmail <> "" Then strEmail = Trim(strEmail)
    End If


    'If no email address for user display message
    If strEmail = "" Then

    lngMemberNoEmail = lngMemberNoEmail + 1

    end if

    '####### QUESTa query da i numeri !!! #### '


    strSQL = "SELECT * FROM subscriber_list WHERE Email = '" &strEmail& "'"

    With adorst

    .CursorType = 3
    .LockType = 3
    .Open strSQL, adoCon


    If NOT .EOF Then
    blnEmailExists = true

    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "

    .delete
    .movenext


    ' incremento
    lngMemberAlreadyImported = lngMemberAlreadyImported + 1



    end if


    ' questa opzione posso anche toglierla
    ' serve per updatare il database con nuovi utenti

    'If the email doesn't already exsist then enter the email into the database
    If blnEmailExists = False Then

    response.write "<font color=gree>[b]INSERITO: "&strEmail&"</font>"

    'Add new record to a new recorset
    .AddNew

    'Set database fields
    .Fields("Email") = Trim(Mid(strEmail, 1, 50))
    if strName<>"" then
    .Fields("name") = Trim(Mid(strname, 1, 50))
    else
    .Fields("name") = Trim(Mid(strEmail, 1, 50))
    end if
    .Fields("active") = "true"
    .Fields("status") = "1"
    .Fields("sub_date") = date()
    .Update

    .Requery

    End If

    .Close
    End With

    '############################fino a qua ###############################'



    'Display on page number of subscribers to import
    Response.Write(vbCrLf & "<script language=""JavaScript"">"& _
    vbCrLf & " document.getElementById('imported').innerHTML = '" & lngMemberImportCount & "';" & _
    vbCrLf & " document.getElementById('done').innerHTML = '" & lngMemberAlreadyImported & "';" & _
    vbCrLf & " document.getElementById('noemail').innerHTML = '" & lngMemberNoEmail & "';" & _
    vbCrLf & " document.getElementById('total').innerHTML = '" & lngTotalProcessed & "';" & _
    vbCrLf & " document.getElementById('progress').innerHTML = '" & percentageCalculate(lngTotalProcessed, lngTotalRecords, 0) & "';" & _
    vbCrLf & " document.getElementById('bar').style.width = '" & percentageCalculate(lngTotalProcessed, lngTotalRecords, 0) & "';" & _
    vbCrLf & "</script>")


    Next
    Set adorst = Nothing
    Set adocon = Nothing
    End Sub

    '******************************************
    '*** Calculate Percentage ****
    '******************************************

    Private Function percentageCalculate(ByRef lngNumberProcessed, ByRef lngTotalToProcess, ByRef intDecPlaces)

    'If there are no newsletters sent yet then format the percent by 0 otherwise an overflow error will happen
    If lngTotalProcessed = 0 Then
    percentageCalculate = FormatPercent(1, 1)

    'Else read in the the percentage of newsletters sent
    Else
    percentageCalculate = FormatPercent((lngNumberProcessed / lngTotalToProcess), intDecPlaces)
    End If

    End Function

    %>
    <tr>
    <table border="0" width=640 align=center>
    <td id="bar" bgcolor=lightgreen style="width:100%;"></td>
    <td id="progress" bgcolor=red ></td>
    </tr>
    </table>
    <tr>
    <table width=640 align=center border=0 cellspacing=0 cellpadding=0>
    <tr>
    <td>Campi trovati</td><td id="subscribers"></td>
    <td>Campi vuoti</td><td id="noemail"></td>
    <td>Campi già importati</td><td id="done"></td>
    <td>Processati</td><td id="total"></td>
    <td>Campi inseriti</td><td id="imported"><td>

    </tr>
    </table>
    </body>
    <%
    Call GetCsvSubscribers()
    %>
    Ciao...prova a mettere .movefirst dopo la cancellazione
    magari legge il secondo record con la stessa chiave...riposizionandosi

    sempre che il recordset abbia la possibilità di eseguire movefirst....perchè alcuni tipi di Recordset possono solo andare in avanti...
    ciao
    Vic53
    Vic53

  7. #7
    Utente di HTML.it
    Registrato dal
    Dec 2010
    Messaggi
    4

    niente da fare

    ciao ,lo ridotto cosi ma è lo stesso ho provato fare anche il moveFirst non va

    dim risultato
    dim test
    test= request.form("output")


    risultato= split(test,",")
    for x=1 to ubound(risultato)
    strEmail=(risultato)(x)

    strSQL = "select * FROM subscriber_list WHERE Email = '" &strEmail& "'"
    Response.Write(strSQL)
    With adorst

    .CursorType = 3
    .LockType = 3
    .Open strSQL, adoCon

    If NOT .EOF Then

    do while not .eof
    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "
    .delete
    .movenext
    loop
    response.write "
    vuoto"
    end if
    .close
    End With
    Set adorst = Nothing
    Set adocon = Nothing
    next

  8. #8
    Utente di HTML.it L'avatar di vic53
    Registrato dal
    Oct 2010
    residenza
    Fonte Nuova (Roma)
    Messaggi
    592

    Re: niente da fare

    Originariamente inviato da bromuro
    ciao ,lo ridotto cosi ma è lo stesso ho provato fare anche il moveFirst non va

    dim risultato
    dim test
    test= request.form("output")


    risultato= split(test,",")
    for x=1 to ubound(risultato)
    strEmail=(risultato)(x)

    strSQL = "select * FROM subscriber_list WHERE Email = '" &strEmail& "'"
    Response.Write(strSQL)
    With adorst

    .CursorType = 3
    .LockType = 3
    .Open strSQL, adoCon

    If NOT .EOF Then

    do while not .eof
    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "
    .delete
    .movenext
    loop
    response.write "
    vuoto"
    end if
    .close
    End With
    Set adorst = Nothing
    Set adocon = Nothing
    next

    ciao
    puoi provare così....? vediamo se è la sequenza...

    If NOT .EOF Then

    do while not .eof
    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "
    .delete
    .movenext
    loop
    ..............
    ciao
    Vic53
    Vic53

  9. #9
    Utente di HTML.it L'avatar di vic53
    Registrato dal
    Oct 2010
    residenza
    Fonte Nuova (Roma)
    Messaggi
    592

    Re: Re: niente da fare

    Originariamente inviato da vic53
    ciao
    puoi provare così....? vediamo se è la sequenza...

    If NOT .EOF Then

    do while not .eof
    response.write "<font color=yellow >[b]"&strEmail&"ce già ->"& .fields("email")& "</font>
    "
    .delete
    .movenext
    loop
    ..............
    ciao
    Vic53
    A no scusa lo avevi gia provato....

    Però è strano che non funzioni ma le chiavi sul DB sono a posto? prova a ricompattare il database Access potrebbe essere lui a non funzionare correttamente
    le instruzioni di compattamento sono su Access...
    ciao
    Vic53
    Vic53

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.