Newsgroup: it.comp.www.asp
Titolo: Aiuto con questo errore

Ho un codice su errore su questa riga
set rs = Conn.Execute(sql)
se lascio execute ottengo :
Errore di run-time di Microsoft VBScript (0x800A01A8)
Necessario oggetto: ''
se la riga la faccio diventare
set rs = Conn.Open(sql)
l'errore diventa :
L'operazione non è consentita se l'oggetto è aperto.
vi riporto il codice comleto della pag
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/blogConn.asp" -->
<%
Dim myBlog__MMColMonth
myBlog__MMColMonth = "Month(Date())"
If (Month(Date())  <> "") Then
  myBlog__MMColMonth = Month(Date())
End If
%>
<%
Dim myBlog__MMColYear
myBlog__MMColYear = "Year(Date())"
If (Year(Date()) <> "") Then
  myBlog__MMColYear = Year(Date())
End If
%>
<%
MM_blogConn_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("./assets/bloggerdb.mdb")
Dim myBlog
Dim myBlog_numRows
Set myBlog = Server.CreateObject("ADODB.Recordset")
myBlog.ActiveConnection = MM_blogConn_STRING
myBlog.Source = "SELECT id, month, year, date, topic, comments  FROM blog
WHERE month = " + Replace(myBlog__MMColMonth, "'", "''") + " AND year= " +
Replace(myBlog__MMColYear, "'", "''") + "  ORDER BY date DESC"
myBlog.CursorType = 0
myBlog.CursorLocation = 2
myBlog.LockType = 1
myBlog.Open()
myBlog_numRows = 0
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats
variables
Dim myBlog_total
Dim myBlog_first
Dim myBlog_last
' set the record count
myBlog_total = myBlog.RecordCount
' set the number of rows displayed on this page
If (myBlog_numRows < 0) Then
  myBlog_numRows = myBlog_total
Elseif (myBlog_numRows = 0) Then
  myBlog_numRows = 1
End If
' set the first and last displayed record
myBlog_first = 1
myBlog_last  = myBlog_first + myBlog_numRows - 1
' if we have the correct record count, check the other stats
If (myBlog_total <> -1) Then
  If (myBlog_first > myBlog_total) Then
    myBlog_first = myBlog_total
  End If
  If (myBlog_last > myBlog_total) Then
    myBlog_last = myBlog_total
  End If
  If (myBlog_numRows > myBlog_total) Then
    myBlog_numRows = myBlog_total
  End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs    = myBlog
MM_rsCount   = myBlog_total
MM_size      = myBlog_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
  ' use index parameter if defined, otherwise use offset parameter
  MM_param = Request.QueryString("index")
  If (MM_param = "") Then
    MM_param = Request.QueryString("offset")
  End If
  If (MM_param <> "") Then
    MM_offset = Int(MM_param)
  End If
  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move
last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full
repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If
  ' move the cursor to the selected record
  MM_index = 0
  While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
  If (MM_rs.EOF) Then
    MM_offset = MM_index  ' set MM_offset to the last possible record
  End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display
range
If (MM_rsCount = -1) Then
  ' walk to the end of the display range for this page
  MM_index = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsCount) Then
      MM_size = MM_rsCount
    End If
  End If
  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If
  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If
  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rs.EOF And MM_index < MM_offset)
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
myBlog_first = MM_offset + 1
myBlog_last  = MM_offset + MM_size
If (MM_rsCount <> -1) Then
  If (myBlog_first > MM_rsCount) Then
    myBlog_first = MM_rsCount
  End If
  If (myBlog_last > MM_rsCount) Then
    myBlog_last = MM_rsCount
  End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** 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
%>
<%
' *** Move To Record: set the strings for the first, last, next, and
previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained
parameters
If (MM_size > 1) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    MM_paramList = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For MM_paramIndex = 0 To UBound(MM_paramList)
      MM_nextParam = Left(MM_paramList(MM_paramIndex),
InStr(MM_paramList(MM_paramIndex),"=") - 1)
      If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then
  MM_keepMove = MM_keepMove & "&"
End If
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove &
MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast  = MM_urlStr & "-1"
MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
  MM_movePrev = MM_urlStr & "0"
Else
  MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
myBlog_numRows = myBlog_numRows + Repeat2__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Blogger | My Blog</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);
//-->
</script>
<link href="assets/blogStyles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<div id="content"> <img src="assets/logo.gif" alt="Blogger | Logo"
width="300" height="90">
<%
While ((Repeat2__numRows <> 0) AND (NOT myBlog.EOF))
%>
<TABLE cellSpacing="0" cellPadding="0" border="0">
 <TR>
  <TD background="ImagesBlog/tab02.gif" colSpan="2"><IMG
src="ImagesBlog/tab01.gif" alt=""></TD>
  <TD vAlign="center" noWrap width="100%"
background="ImagesBlog/tab02.gif"></TD>
  <TD><IMG src="ImagesBlog/tab03.gif" alt=""></TD>
 </TR>
 <TR>
   <TD width="1%" background="ImagesBlog/tab08.gif"><IMG
src="ImagesBlog/tab08.gif" alt=""></TD>
    <TD colSpan="2">
  <p class="blogHeader">::<%=(myBlog.Fields.Item("date").Value)%>::<span
class="blogText"><%=(myBlog.Fields.Item("topic").Value)%></span>::</p>
  <p><br>
    <%=(myBlog.Fields.Item("comments").Value)%> </p>
 <%
 id = myBlog.Fields.Item("id").Value
 id = CInt(id)
 sql = "SELECT id FROM comment WHERE id = "&id&""
 set rs = myBlog.open(sql)                  ' QUI HO L'ERRORE
 totalcomment = rs.RecordCount
 Response.Write sql
 Response.Write("<a
href=""AddComment.asp?id="&id&""">commenti</a><br>&nbsp;") %>
        </TD>
   <TD background="ImagesBlog/tab04.gif">&nbsp;</TD>
  </TR>
  <TR>
   <TD background="ImagesBlog/tab06.gif" colSpan="2"><IMG
src="ImagesBlog/tab07.gif" alt=""></TD>
   <TD background="ImagesBlog/tab06.gif">&nbsp;</TD>
   <TD><IMG src="ImagesBlog/tab05.gif" alt=""></TD>
  </TR>
</TABLE>
  <p>&nbsp;</p>
  <%
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  myBlog.MoveNext()
Wend
%>
  <p class="blogHeader">&nbsp; </p>
</div>
<div id="navigation">
  <p class="navheader">&nbsp;</p>
  <p class="navheader">&nbsp;</p>
  <p class="navheader">&nbsp;</p>
  <p class="navheader">&nbsp;</p>
  <p class="navheader">Navigate</p>
  <p class="navtext"><a href="javascript:;" title="About me">About
Me</a><br>
    <a href="javascript:;" title="My Resume">My Resume</a><br>
    <a href="javascript:;" title="My Portfolio">My Portfolio</a><br>
    <a href="default.asp">My Blog</a></p>
  <p class="navheader">Altro :-)</p>
  <p class="navtext">
</p>
  <p class="navheader">Archieves</p>
  <form name="form1" method="get" action="archives.asp">
    <p class="navtext">
      <select name="txtmonth" class="drops">
        <%
     FOR i = 1 to 12
     j = " "
     IF Month(Now) = i THEN
       j = " selected "
     END IF
     %>
        <option<%=j%>value="<%=i%>"><%=Left(MonthName(i),3)%></option>
        <%
     NEXT
     %>
      </select>
      <select name="txtyear" class="drops">
        <%
     FOR i = 2002 to 2010
            j = " "
            IF Year(Now) = i THEN
              j = " selected "
            END IF
     %>
        <option<%=j%>value="<%=i%>"><%=i%></option>
        <%
     NEXT
     %>
      </select>
      <input type="submit" name="Submit" value="Submit" class="drops">
    </p>
   </form>
<p class="navtext">
    <a href="
http://validator.w3.org/check/referer
"><img border="0"
        src="
http://www.w3.org/Icons/valid-html401
"
        alt="Valid HTML 4.01!" height="31" width="88"></a>
  </p>
</div>
</body>
</html>
<%
myBlog.Close()
Set myBlog = Nothing
%>

 set rs = Conn.Execute(sql)
Ciao...
1) è inutile postare 500 righe di codice, basta un buon pezzo del codice
dove si verifica l'errore.
2) Cosa vuoi fare su quella linea? Vuoi caricare un recordset e utilizzare
RecordCount?
Se è così l'istruzione da usare, dopo aver aperto la connessione, diciamo,
Conn:
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql, Conn, 1
Ciao
nixs

 
Vedi che non capisci un tubo di quello che Dreamweaver ha fatto, oltre 
che hai una fracca di righe che non servono a un tubo.
MOLLALO!
Cmq: l'oggetto Conn non esiste.
Conn, in questo caso, dovrebbe essere l'oggetto connessione al database.
Tu invece hai solo myBlog, che peraltro è un recordset.
Allora: abbandona tutta la pappardella di DW.
Ragiona BENE su cosa devi fare, se hai bisogno di aiuto posta qui.
A occhio, sembrerebbe che apri un recordset (scritto da DW), poi fai un 
loop per tutti i record. Nel mezzo del loop, sembra che tu (scritto tu a 
mano) apra ogni volta un recordset per ottenere il Recordcount da una 
seconda tabella. 
Puoi evitare di fare una cosa pesantissima come questa unendo le due 
tabelle in un'unica query (con un JOIN).


ho sbagliato a scivere la riga dell'errore... è questa
 id = myBlog.Fields.Item("id").Value
 id = CInt(id)
 sql = "SELECT id FROM comment WHERE id = "&id&""
 set rs = myBlog.open(sql)   '<- qui ho l'errore
 totalcomment = rs.RecordCount
myBlog è la connessione al db
il codice che ho postato non è ancora completo, aspettavo a vedere se la
query veniva eseguita
io con il recordcount, voglio mettere il valore in una variabile, da
visualizzare se il tal recorset non è vuoto...
io penso che lerrore avvenga da come è stata aperta la connessione al db...
ma purtoppo quella parte non l'ho fatta io (devo riutilzzare del codice di
chi non so chi)...
le righe di connessione te le riporto
MM_blogConn_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("./assets/bloggerdb.mdb")
Dim myBlog
Dim myBlog_numRows
Set myBlog = Server.CreateObject("ADODB.Recordset")
myBlog.ActiveConnection = MM_blogConn_STRING
myBlog.Source = " CUT CUT CUT"


 tabelle in un'unica query (con un JOIN).
no perchč la seconda tabella puo non avere record per quell'id...
quindi la join fallirebbe, se non sbaglio..
cmq scusa per il mio post cmq non mi sembra che devi "ingiuriare" cosi un
utente.. fin dei conti parlavo sempre di asp e non ho postato un messaggio
non inerente

 Server.MapPath("./assets/bloggerdb.mdb")
[...]
E' un casino... come diceva rozilipo... o ti decidi a comprendere l'ASP
e butti via DW oppure ti procuri pagine già funzionanti, senza modificare
una virgola.
:-))
Ciao
Nixs

 non inerente
Ah non volevo affatto essere pesante o pedante...solo che, vedi, se 
anzichč usare DW ed avere la pappa pronta (che come puoi notare NON č 
buona) ti fossi letto qualche tutorial, anche quelli semplici come su 
w3schools, avresti fatto bene ed anche prima.
PS: e bada che lo stesso percorso che stai facendo tu, l'ho fatto 
anch'io qualche ano fa. 
Anch'io avevo Dreamweaver Ultradev, e ci ho perso su un sacco di tempo.