Salve a tutti, ho un piccolissimo problemino, è molto poco che mi sono avvicinato alla programmazione web mediante Dreamweaver in quanto vorrei pubblicare un sito sulla "vita calcistica" del Taranto, questo sito si appoggia su dei database in access. Dopo aver fatto alcune scelte come l'anno di interesse, selezionato la giornata e visualizzato gli incontri di una selezionata giornata non riesco a visualizzare la classifica passando dei parametri di sessione nel mio recordset. L'errore che ho è il seguente:
Tipo di errore:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][Driver ODBC Microsoft Access] Errore di sintassi (operatore mancante) nell'espressione della query 'annocampionato=1927 and numetipogiornata=1andata'.
/taranto/centro3.asp, line 27
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/taranto/Connections/provaconn.asp" -->
<%
Dim Recordset1__anncamp
Recordset1__anncamp = "1927"
If (Request.QueryString("IDannocampionato") <> "") Then
Recordset1__anncamp = Request.QueryString("IDannocampionato")
End If
%>
<%
Dim Recordset1__numtipgiorn
Recordset1__numtipgiorn = "1andata"
If (Request.QueryString("numetipogiornata") <> "") Then
Recordset1__numtipgiorn = Request.QueryString("numetipogiornata")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_provaconn_STRING
Recordset1.Source = "select annocampionato, numetipogiornata, squadra, punteggio, giocate, totvinte, totpareg, totperse, totgf, totgs, vc, nc, pc, gfc, gsc, vfc, nfc, pfc, gff, gsf FROM Classifiche WHERE annocampionato=" + Replace(Recordset1__anncamp, "'", "''") + " and numetipogiornata=" + Replace(Recordset1__numtipgiorn, "'", "''")
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
%>
<!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=iso-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>
<p> </p>
<table border="1">
<tr>
<td>annocampionato</td>
<td>numetipogiornata</td>
<td>squadra</td>
<td>punteggio</td>
<td>giocate</td>
<td>totvinte</td>
<td>totpareg</td>
<td>totperse</td>
<td>totgf</td>
<td>totgs</td>
<td>vc</td>
<td>nc</td>
<td>pc</td>
<td>gfc</td>
<td>gsc</td>
<td>vfc</td>
<td>nfc</td>
<td>pfc</td>
<td>gff</td>
<td>gsf</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
<tr>
<td><%=(Recordset1.Fields.Item("annocampionato").Value)%></td>
<td><%=(Recordset1.Fields.Item("numetipogiornata").Value)%></td>
<td><%=(Recordset1.Fields.Item("squadra").Value)%></td>
<td><%=(Recordset1.Fields.Item("punteggio").Value)%></td>
<td><%=(Recordset1.Fields.Item("giocate").Value)%></td>
<td><%=(Recordset1.Fields.Item("totvinte").Value)%></td>
<td><%=(Recordset1.Fields.Item("totpareg").Value)%></td>
<td><%=(Recordset1.Fields.Item("totperse").Value)%></td>
<td><%=(Recordset1.Fields.Item("totgf").Value)%></td>
<td><%=(Recordset1.Fields.Item("totgs").Value)%></td>
<td><%=(Recordset1.Fields.Item("vc").Value)%></td>
<td><%=(Recordset1.Fields.Item("nc").Value)%></td>
<td><%=(Recordset1.Fields.Item("pc").Value)%></td>
<td><%=(Recordset1.Fields.Item("gfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("gsc").Value)%></td>
<td><%=(Recordset1.Fields.Item("vfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("nfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("pfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("gff").Value)%></td>
<td><%=(Recordset1.Fields.Item("gsf").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<p> </p>
<table width="200" border="1">
<tr>
<td><%response.write(Session("anncamp")) %></td>
<td><%response.write(Session("numtipgiorn")) %></td>
</tr>
</table>
<p> </p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
non capisco cosa possa esserci di sbagliato questa è la condizione che ho impostato
where annocampionato=" + Replace(Recordset1__anncamp, "'", "''") + " and numetipogiornata=" + Replace(Recordset1__numtipgiorn, "'", "''")
senza la condizione
and numetipogiornata=" + Replace(Recordset1__numtipgiorn, "'", "''")
tutto funziona.
spero di essere stato chiaro chi può aiutarmi??????:beer:
Tipo di errore:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][Driver ODBC Microsoft Access] Errore di sintassi (operatore mancante) nell'espressione della query 'annocampionato=1927 and numetipogiornata=1andata'.
/taranto/centro3.asp, line 27
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/taranto/Connections/provaconn.asp" -->
<%
Dim Recordset1__anncamp
Recordset1__anncamp = "1927"
If (Request.QueryString("IDannocampionato") <> "") Then
Recordset1__anncamp = Request.QueryString("IDannocampionato")
End If
%>
<%
Dim Recordset1__numtipgiorn
Recordset1__numtipgiorn = "1andata"
If (Request.QueryString("numetipogiornata") <> "") Then
Recordset1__numtipgiorn = Request.QueryString("numetipogiornata")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_provaconn_STRING
Recordset1.Source = "select annocampionato, numetipogiornata, squadra, punteggio, giocate, totvinte, totpareg, totperse, totgf, totgs, vc, nc, pc, gfc, gsc, vfc, nfc, pfc, gff, gsf FROM Classifiche WHERE annocampionato=" + Replace(Recordset1__anncamp, "'", "''") + " and numetipogiornata=" + Replace(Recordset1__numtipgiorn, "'", "''")
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
%>
<!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=iso-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>
<p> </p>
<table border="1">
<tr>
<td>annocampionato</td>
<td>numetipogiornata</td>
<td>squadra</td>
<td>punteggio</td>
<td>giocate</td>
<td>totvinte</td>
<td>totpareg</td>
<td>totperse</td>
<td>totgf</td>
<td>totgs</td>
<td>vc</td>
<td>nc</td>
<td>pc</td>
<td>gfc</td>
<td>gsc</td>
<td>vfc</td>
<td>nfc</td>
<td>pfc</td>
<td>gff</td>
<td>gsf</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
<tr>
<td><%=(Recordset1.Fields.Item("annocampionato").Value)%></td>
<td><%=(Recordset1.Fields.Item("numetipogiornata").Value)%></td>
<td><%=(Recordset1.Fields.Item("squadra").Value)%></td>
<td><%=(Recordset1.Fields.Item("punteggio").Value)%></td>
<td><%=(Recordset1.Fields.Item("giocate").Value)%></td>
<td><%=(Recordset1.Fields.Item("totvinte").Value)%></td>
<td><%=(Recordset1.Fields.Item("totpareg").Value)%></td>
<td><%=(Recordset1.Fields.Item("totperse").Value)%></td>
<td><%=(Recordset1.Fields.Item("totgf").Value)%></td>
<td><%=(Recordset1.Fields.Item("totgs").Value)%></td>
<td><%=(Recordset1.Fields.Item("vc").Value)%></td>
<td><%=(Recordset1.Fields.Item("nc").Value)%></td>
<td><%=(Recordset1.Fields.Item("pc").Value)%></td>
<td><%=(Recordset1.Fields.Item("gfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("gsc").Value)%></td>
<td><%=(Recordset1.Fields.Item("vfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("nfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("pfc").Value)%></td>
<td><%=(Recordset1.Fields.Item("gff").Value)%></td>
<td><%=(Recordset1.Fields.Item("gsf").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<p> </p>
<table width="200" border="1">
<tr>
<td><%response.write(Session("anncamp")) %></td>
<td><%response.write(Session("numtipgiorn")) %></td>
</tr>
</table>
<p> </p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
non capisco cosa possa esserci di sbagliato questa è la condizione che ho impostato
where annocampionato=" + Replace(Recordset1__anncamp, "'", "''") + " and numetipogiornata=" + Replace(Recordset1__numtipgiorn, "'", "''")
senza la condizione
and numetipogiornata=" + Replace(Recordset1__numtipgiorn, "'", "''")
tutto funziona.
spero di essere stato chiaro chi può aiutarmi??????:beer: