Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Problema campo vuoto

  1. #1
    Utente di HTML.it
    Registrato dal
    Aug 2011
    Messaggi
    3

    Problema campo vuoto

    Ragazzi sto avendo un problema con un sito che ho ereditato e di cui sto facendo il restyling.

    Una parte del sito si poggia su un database access. In una pagina specifica (http://www.associazioneart.it/ArtNew/marchi.asp) ricevo un errore ASP quando vado a cercare un marchio in una regione che non ne ha (ad es. provate con Liguria).

    L'errore è:

    ADODB.Field error '800a0bcd'

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    /ArtNew/marchiag.asp, line 207

    Alla linea 207 il mio file marchiag.asp recita:


    codice:
     <p align="center"><font color="#000033">Per la Regione <font color="#FF0000"> <%=(Recordset1.Fields.Item("Regionebis").Value)%></font>ci sono <font color="#FF0000"><%=(Recordset1_total)%></font>Marchi</font></p>
    Eseguo anche un controllo sui record vuoti tramite il quale dovrebbe uscire un messaggio di del tipo "nessun marchio in questa regione"- In basso il codice completo della pagina.

    Come posso risolvere il problema ?
    Grazie in anticipo!

    codice:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> 
    
    <%
    Dim Recordset1__MMColParam
    Recordset1__MMColParam = "1"
    If (Request.Form("select") <> "") Then 
      Recordset1__MMColParam = Request.Form("select")
    End If
    %>
    <%
    Dim Recordset1
    Dim Recordset1_numRows
    
    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    Recordset1.ActiveConnection = MM_connession_STRING
    Recordset1.Source = "SELECT * FROM ditteag1 WHERE Regionebis = '" + Replace(Recordset1__MMColParam, "'", "''") + "' ORDER BY Azienda ASC"
    Recordset1.CursorType = 0
    Recordset1.CursorLocation = 2
    Recordset1.LockType = 1
    Recordset1.Open()
    
    Recordset1_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index
    
    Repeat1__numRows = -1
    Repeat1__index = 0
    Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
    %>
    
    <%
    '  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
    
    Dim Recordset1_total
    Dim Recordset1_first
    Dim Recordset1_last
    
    ' set the record count
    Recordset1_total = Recordset1.RecordCount
    
    ' set the number of rows displayed on this page
    If (Recordset1_numRows < 0) Then
      Recordset1_numRows = Recordset1_total
    Elseif (Recordset1_numRows = 0) Then
      Recordset1_numRows = 1
    End If
    
    ' set the first and last displayed record
    Recordset1_first = 1
    Recordset1_last  = Recordset1_first + Recordset1_numRows - 1
    
    ' if we have the correct record count, check the other stats
    If (Recordset1_total <> -1) Then
      If (Recordset1_first > Recordset1_total) Then
        Recordset1_first = Recordset1_total
      End If
      If (Recordset1_last > Recordset1_total) Then
        Recordset1_last = Recordset1_total
      End If
      If (Recordset1_numRows > Recordset1_total) Then
        Recordset1_numRows = Recordset1_total
      End If
    End If
    %>
    <%
    ' *** Recordset Stats: if we don't know the record count, manually count them
    
    If (Recordset1_total = -1) Then
    
      ' count the total records by iterating through the recordset
      Recordset1_total=0
      While (Not Recordset1.EOF)
        Recordset1_total = Recordset1_total + 1
        Recordset1.MoveNext
      Wend
    
      ' reset the cursor to the beginning
      If (Recordset1.CursorType > 0) Then
        Recordset1.MoveFirst
      Else
        Recordset1.Requery
      End If
    
      ' set the number of rows displayed on this page
      If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
        Recordset1_numRows = Recordset1_total
      End If
    
      ' set the first and last displayed record
      Recordset1_first = 1
      Recordset1_last = Recordset1_first + Recordset1_numRows - 1
      
      If (Recordset1_first > Recordset1_total) Then
        Recordset1_first = Recordset1_total
      End If
      If (Recordset1_last > Recordset1_total) Then
        Recordset1_last = Recordset1_total
      End If
    
    End If
    %>
    <%
    Dim MM_paramName 
    %>
    <%
    ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
    
    Dim MM_keepNone
    Dim MM_keepURL
    Dim MM_keepForm
    Dim MM_keepBoth
    
    Dim MM_removeList
    Dim MM_item
    Dim MM_nextItem
    
    ' create the list of parameters which should not be maintained
    MM_removeList = "&index="
    If (MM_paramName <> "") Then
      MM_removeList = MM_removeList & "&" & MM_paramName & "="
    End If
    
    MM_keepURL=""
    MM_keepForm=""
    MM_keepBoth=""
    MM_keepNone=""
    
    ' add the URL parameters to the MM_keepURL string
    For Each MM_item In Request.QueryString
      MM_nextItem = "&" & MM_item & "="
      If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
        MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
      End If
    Next
    
    ' add the Form variables to the MM_keepForm string
    For Each MM_item In Request.Form
      MM_nextItem = "&" & MM_item & "="
      If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
        MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
      End If
    Next
    
    ' create the Form + URL string and remove the intial '&' from each of the strings
    MM_keepBoth = MM_keepURL & MM_keepForm
    If (MM_keepBoth <> "") Then 
      MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
    End If
    If (MM_keepURL <> "")  Then
      MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
    End If
    If (MM_keepForm <> "") Then
      MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
    End If
    
    ' a utility function used for adding additional parameters to these strings
    Function MM_joinChar(firstItem)
      If (firstItem <> "") Then
        MM_joinChar = "&"
      Else
        MM_joinChar = ""
      End If
    End Function
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Agenti Rappresentanti Tessili</title>
    <meta name="keywords" content="Agenti, Rappresentanti, tessili, ART, Associazione, marchi, giacobelli" />
    <meta name="description" content="ART - Agenti Rappresentanti Tessili" />
    <link href="templatemo_style.css" rel="stylesheet" type="text/css" />
    
    <link rel="stylesheet" href="css/coda-slider.css" type="text/css" />
    
    <script src="js/jquery-1.2.6.js" type="text/javascript"></script>
    <script src="js/jquery.scrollTo-1.3.3.js" type="text/javascript"></script>
    <script src="js/jquery.localscroll-1.2.5.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.serialScroll-1.2.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/coda-slider.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.easing.1.3.js" type="text/javascript" charset="utf-8"></script>
    
    
    </head>
    <body>
    	
        <div id="slider">
        <div id="templatemo_wrapper">
        	
            <div id="header">
                
                <div id="site_title"><h1>AssociazioneArt.it</h1></div>
                
                        </div>
            
            <div id="content-flex">
            
                <div class="scroll-flex">
                    <div class="scrollContainer-h">
                    
                                                           
                                        
                                        
                        <div class="panel" id="mmare">
                      <p align="center"><font color="#000033">Per la Regione <font color="#FF0000"> <%=(Recordset1.Fields.Item("Regionebis").Value)%></font>ci sono <font color="#FF0000"><%=(Recordset1_total)%></font>Marchi</font></p>
    
    
     </p>
    <table width="82%" border="0">
      <tr> 
        <td width="50%"><div align="center"><font color="#FF0000">Azienda</font></div></td>
        <td width="17%"><div align="center"><font color="#FF0000">Linea</font></div></td>
        <td width="33%"><div align="center"><font color="#FF0000">Logo</font></div></td>
      </tr>
      <% If Recordset1.EOF And Recordset1.BOF Then %>
      <tr> 
        <td bgcolor="#00FF66"><font color="#FF0000">Nessun 
          Marchio per questa Regione</font></td>
        <td></td>
        <td></td>
      </tr>
      <% End If ' end Recordset1.EOF And Recordset1.BOF %>
      <% 
    While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
    %>
      <tr> 
        <td><form name="form1" method="post" action="">
            <input name="hiddenField" type="hidden" value="<%=(Recordset1.Fields.Item("IDDitte").Value)%>">
            "><font size="-1">Sc.Az.</font><font color="#000033" size="-1"><%=(Recordset1.Fields.Item("Azienda").Value)%></font> </form></td>
        <td><font color="#000033" size="-1"><%=(Recordset1.Fields.Item("Linea").Value)%></font></td>
        <td><form name="form2" method="post" action="">
            <input type="image" border="0" name="imageField" src="<%=(Recordset1.Fields.Item("LOGO").Value)%>">
          </form></td>
      </tr>
      <% 
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      Recordset1.MoveNext()
    Wend
    %>
    </table>
    
                            
                            
                            
    
    
                        </div>
                        
                                            
                    </div>
                </div>
                
                
            
            </div> 
            
            
            
            <div id="footer-flex">
            
                <div id="social_box">
                    <!-- [img]images/facebook.png[/img]
                    [img]images/flickr.png[/img]
                    [img]images/myspace.png[/img]
                    [img]images/twitter.png[/img]
                    [img]images/youtube.png[/img] -->
                </div>
            
                <div id="copyright">
                    <small>Copyright © 2011 A.R.T. - Agenti Rappresentanti Tessili Via Oriani,8 70122 BARI 
    
                    tel. 080.5610101 - 080.5241477 fax 080.5042024 - REA XXXXXXX - P.IVA XXXXXXXXXXXXXXXXXX - Cap. Soc. XXXXXXXXXXX</small></div>
                
            </div>
        
        </div> 
        </div> 
    
    </body>
    </html>
    <%
    Recordset1.Close()
    Set Recordset1 = Nothing
    %>

  2. #2
    difficile districarsi in tutto quel codice! comunque tu non devi controllare il record vuoto, ma il recordset.

    IF RS.EOF THEN
    ' recordset vuoto, nessun record soddisfa i criteri di ricerca, messaggio d'errore
    ELSE
    ' visualizza quello che devi
    END IF

    that easy!

  3. #3
    Utente di HTML.it
    Registrato dal
    Aug 2011
    Messaggi
    3
    E' più o meno così che è fatto.
    Sono a digiuno di asp.

    Nella pagina analoga relativa agli "agenti" è riproposta la stessa struttura del file asp con gli stessi controlli e tutto funziona regolarmente...

    Any Help?

  4. #4
    cerca di isolare il pezzo di codice che ti dà errore e postalo (quindi, NON tutto il codice)

  5. #5
    Utente di HTML.it
    Registrato dal
    Aug 2011
    Messaggi
    3
    L'avevo già fatto :-)

    L'errore è:

    ADODB.Field error '800a0bcd'

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    /ArtNew/marchiag.asp, line 207

    Alla linea 207 il mio file marchiag.asp recita:

    codice:
    <p align="center"><font color="#000033">Per la Regione <font color="#FF0000"> <%=(Recordset1.Fields.Item("Regionebis").Value)%></font> ci sono   <font color="#FF0000"><%=(Recordset1_total)%></font>  Marchi</font></p>
    Avevo postato tutto il codice perchè secondo me può dare l'errore sulla riga 207 causato da qualche errore nel codice della pagina.

  6. #6
    lo vedi da solo l'errore

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    leggendo

    Recordset1.Fields.Item("Regionebis").Value

    vuol dire che NON testi la condizione EOF di Recordset1.

    Può darsi che tu l'abbia fatto per altri RS ma non per quello. Riguarda attentamente il tuo codice.


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