Per me la struttura è corretta:
codice:
<%
on error resume next
Dim quanti
quanti = 1
Dim Modello
Modello = request.QueryString("Model")
Dim InsModello
Dim comandoInsModello
'verifico se esiste già la tabella altrimenti la aggiungo
Dim RsVerificoTabella
Set RsVerificoTabella = Server.CreateObject("ADODB.Recordset")
RsVerificoTabella.ActiveConnection = MM_Connetti_STRING
RsVerificoTabella.source = "SELECT * FROM " & Session.SessionID & ""
RsVerificoTabella.Open()
if (RsVerificoTabella.BOF <> true) and (RsVerificoTabella.Eof <> true) then
Dim creatab
Dim comandocreatab
Set creatab = Server.CreateObject("ADODB.Command")
creatab.ActiveConnection = MM_Connetti_STRING
comandocreatab = "CREATE TABLE [" & session.SessionID &"] (Model Text(7), Quantity Integer)"
creatab.CommandText = comandocreatab
creatab.execute
'creatab.close
else
end if
%>
<%
'verifico se esiste già il modello altrimenti lo aggiungo
Dim RsVerificoModello
Set RsVerificoModello = Server.CreateObject("ADODB.Recordset")
RsVerificoModello.ActiveConnection = MM_Connetti_STRING
RsVerificoModello.source = "SELECT * FROM " & Session.SessionID & " WHERE Model ='" & Modello & "'"
RsVerificoModello.Open()
Dim insvalore
Dim comandoinsvalore
if (RsVerificoModello.BOF <> true) and (RsVerificoModello.Eof <> true) then
quanti = ((RsVerificoModello.Fields.Item("Quantity").Value) + 1)
Set insvalore = Server.CreateObject("ADODB.Command")
insvalore.ActiveConnection = MM_Connetti_STRING
comandoinsvalore = "UPDATE " & session.SessionID & " SET Quantity =" & quanti & " WHERE Model = '" & Modello & "'"
insvalore.CommandText = comandoinsvalore
insvalore.execute
insvalore.close
else
Set insvalore = Server.CreateObject("ADODB.Command")
insvalore.ActiveConnection = MM_Connetti_STRING
comandoinsvalore = "INSERT INTO [" & session.SessionID &"] (Model,Quantity) VALUES ('" & Modello & "', '" & quanti & "')"
insvalore.CommandText = comandoinsvalore
insvalore.execute
insvalore.close
end if
%>
<%
RsVerificoModello.Close()
Set RsVerificoModello = Nothing
%>
ora i valori sono inseriti e procedo con l'output a video:
codice:
<%
'Leggo dalla tabella SessionId
Dim RsTabellaTemporanea
Dim RsTabellaTemporanea_numRows
Set RsTabellaTemporanea = Server.CreateObject("ADODB.Recordset")
RsTabellaTemporanea.ActiveConnection = MM_Connetti_STRING
RsTabellaTemporanea.Source = "SELECT * FROM " & Session.SessionID & ""
RsTabellaTemporanea.Open()
RsTabellaTemporanea_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
RsTabellaTemporanea_numRows = RsTabellaTemporanea_numRows + Repeat1__numRows
%>
<%
While ((Repeat1__numRows <> 0) AND (NOT RsTabellaTemporanea.EOF))
%>
<%=(RsTabellaTemporanea.Fields.Item("Model").Value)%>
<%=(RsTabellaTemporanea.Fields.Item("Quantity").Value)%>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
RsTabellaTemporanea.MoveNext()
Wend
%>
perchè non va?????????