Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Loop strano

  1. #1

    Loop Starno

    Salve amici,
    ho fatto un portale in asp molto semplice con un DB access. Delle persone da remoto sfruttando lo stesso user caricano i dati nel DB. A volte succede che quando si va a chiamare il sito dal web, va in loop, la barretta di sotto carica senza aprire nulla. Ho controllato i codici e stanno bene, perchè in fin dei conti funziona, questa cosa capita ogni tanto e devo riavviare il servizio del sito sul server. Qualcuno sà dirmi qualcosa in merito? può essere che quando si è in fase di caricamento si tenta di caricare sulla stessa riga del DB due dati che dovrebbero essere ripartiti su due righe diverse????



    Aiuto......

  2. #2
    Utente di HTML.it L'avatar di 99eros9
    Registrato dal
    Jan 2003
    Messaggi
    2,637
    Senza codice nessuno è in grado di aiutarti.
    Tala är silver men tiga är guld!
    Pubblica il tuo curriculum
    Segnala il tuo sito
    Ancl

  3. #3
    Qui sotto troverai il codice di una delle 5 pagine che costituiscono la home page.
    Sono 5 perchè gli spazi dove si vanno a mettere gli articoli sono 5 e quindi ho usato questo tipo di filtro e controllo. In grassetto troverai la SELECT che permette la visualizzazione dell'articolo.

    E' il codice completo:

    <%
    Dim adoNewsCon 'Database Connection Variable
    Dim rsNewsConfiguration 'Holds the configuartion recordset
    Dim strAdoNewsConfig 'Holds the Database driver and the path and name of the database
    Dim strNewsSQL 'Holds the SQL query for the database
    Dim intPreviewNewsItems 'Number of files shown on each page
    Dim blnNewsLCode 'News page code set to true
    Dim strNewsBgColour 'Holds the background colour of the News Administrator
    Dim strNewsTextColour 'Holds the text colour of the News Administrator
    Dim strNewsTextType 'Holds the font type of the News Administrator
    Dim intNewsTextSize 'Holds the font size of the News Administrator
    Dim intNewsSmallTextSize 'Holds the size of small fonts
    Dim strNewsLinkColour 'Holds the link colour of the News Administrator
    Dim strNewsTableColour 'Holds the table colour
    Dim strNewsTableBorderColour 'Holds the table border colour
    Dim strNewsTableTitleColour 'Holds the table title colour
    Dim strNewsVisitedLinkColour 'Holds the visited link colour of the News Administrator
    Dim strNewsActiveLinkColour 'Holds the active link colour of the News Administrator

    'Create database connection

    'Create a connection odject
    Set adoNewsCon = Server.CreateObject("ADODB.Connection")

    strAdoNewsConfig = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("news/news.mdb")

    'Database driver info for Brinkster
    'strAdoNewsConfig = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/USERNAME/db/news.mdb") 'This one is for Brinkster users place your Brinster username where you see USERNAME

    'Alternative drivers faster than the basic one above
    'strAdoNewsConfig = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("news/news.mdb") 'This one is if you convert the database to Access 97
    'strAdoNewsConfig = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("news/news.mdb") 'This one is for Access 2000/2002

    'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers)
    'strAdoNewsConfig = "DSN = DSN_NAME" 'Place the DSN where you see DSN_NAME

    '---------------------------------------------------------------------------------------------------------------------------------------------

    'Set an active connection to the Connection object
    adoNewsCon.Open strAdoNewsConfig

    'Read in the configuration for the script
    'Intialise the ADO recordset object
    Set rsNewsConfiguration = Server.CreateObject("ADODB.Recordset")

    'Initialise the SQL variable with an SQL statement to get the configuration details from the database
    strNewsSQL = "SELECT tblConfiguration.* From tblConfiguration;"

    'Query the database
    rsNewsConfiguration.Open strNewsSQL, strAdoNewsConfig

    'If there is config deatils in the recordset then read them in
    If NOT rsNewsConfiguration.EOF Then

    'Read in the configuration details from the recordset
    strNewsTextColour = rsNewsConfiguration("text_colour")
    strNewsTextType = rsNewsConfiguration("text_type")
    intNewsTextSize = CInt(rsNewsConfiguration("text_size"))
    intNewsSmallTextSize = CInt(rsNewsConfiguration("small_text_size"))
    strNewsTableColour = rsNewsConfiguration("table_colour")
    strNewsTableBorderColour = rsNewsConfiguration("table_border_colour")
    strNewsTableTitleColour = rsNewsConfiguration("table_title_colour")
    strNewsLinkColour = rsNewsConfiguration("links_colour")
    strNewsVisitedLinkColour = rsNewsConfiguration("visited_links_colour")
    strNewsActiveLinkColour = rsNewsConfiguration("active_links_colour")
    blnNewsLCode = CBool(rsNewsConfiguration("Code"))
    intPreviewNewsItems = rsNewsConfiguration("No_of_preview_items")
    End If

    'Reset server object
    rsNewsConfiguration.Close
    Set rsNewsConfiguration = Nothing

    %>

    <style type="text/css">
    <!--
    .text {font-family: <% = strNewsTextType %>; font-size: <% = intNewsTextSize %>px; color: <% = strNewsTextColour %>}
    .smText {font-family: <% = strNewsTextType %>; font-size: <% = intNewsSmallTextSize %>px; color: <% = strNewsTextColour %>}
    a {font-family: <% = strNewsTextType %>; font-size: <% = intNewsTextSize %>px; color: <% = strNewsLinkColour %>}
    a:hover {font-family: <% = strNewsTextType %>; font-size: <% = intNewsTextSize %>px; color: <% = strNewsActiveLinkColour %>
    color: #FFFFFF;
    text-decoration: underline;
    color: #FFFFFF;
    }
    a:visited {font-family: <% = strNewsTextType %>; font-size: <% = intNewsTextSize %>px; color: <% = strNewsVisitedLinkColour %>
    color: #02319C;
    text-decoration: none;
    color: #02319C;
    }
    a:visited:hover {font-family: <% = strNewsTextType %>; font-size: <% = intNewsTextSize %>px; color: <% = strNewsActiveLinkColour %>}
    .style1 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 9px;
    color: #02319C;
    }
    .style2 {
    font-size: 9px;
    color: #02319C;
    }
    a:link {
    color: #02319C;
    text-decoration: none;
    }
    a:active {
    color: #02319C;
    text-decoration: none;
    }
    body,td,th {
    color: #02319C;
    }
    .style4 {color: #02319C}
    -->
    </style>
    <table width="100%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strNewsTableBorderColour %>">
    <tr>
    <td>
    <table width="100%" height="78" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
    <td align="center" class="text"> <span class="style2">
    <%
    Dim rsNews 'Database recordset holding the news items
    Dim intNewsItems 'Loop counter for displaying the news items

    'Create recorset object
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    intPreviewNewsItems = 3
    'Initalise the strNewsSQL variable with an SQL statement to query the database
    strNewsSQL = "SELECT TOP " & intPreviewNewsItems & " tblNews.* FROM tblNews where locazione = '3' ORDER BY News_Date DESC;"

    'Query the database
    rsNews.Open strNewsSQL, adoNewsCon

    'If there are no news item to display then display a message seying so
    If rsNews.EOF Then Response.Write("<span class=""text"">Spiacente, ma non ci sono dati caricati.</span>")

    'Loop round to display each of the news items
    For intNewsItems = 1 to intPreviewNewsItems

    'Iv there are no records then exit for loop
    If rsNews.EOF Then Exit For

    %>
    </span>
    <table width="100%" height="36" border="0" cellpadding="0" cellspacing="0" bordercolor="#02319C">
    <tr>
    <td align="left" class="style1">

    <a href="news/news_item.asp?NewsID=<% = rsNews("News_ID") %>" target="_blank">
    Ns. riferimento pratica:
    <% = rsNews("Pratica") %>
    </a> -
    Data incanto:
    <% = rsNews("Offerta") %>
    -Prezzo Base:
    <% = rsNews("Valore") %>


    Comune:
    <% = rsNews("Provincia") %>
    - Indirizzo:
    <% = rsNews("Indirizzo") %>
    (" target="_self" class="style4">dettagli)</p> </td>
    </tr>
    </table>
    <span class="style1">
    <%
    'Move to the next record in the recordset
    rsNews.MoveNext
    Next

    'Reset server objects
    rsNews.Close
    Set rsNews = Nothing
    Set strAdoNewsConfig = Nothing
    Set adoNewsCon = Nothing
    %>
    </span> </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>

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.