Hej
Beklager
Jeg har nu indkræset fejlen i linien:
Out item.attributes.getNamedItem("Varenummer")
Scripft kommer lidt omskreven ganske rigtig fra
www.asp24h.com
Koden ser således ud i den fulde form
<%
nVarenummer = Trim(Request.QueryString("id"))
bValid = True
If "" = nVarenummer Or Not IsNumeric(nVarenummer) Then
bValid = False
Else
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Data Source=Brygladen;User ID=sa;Password=;"
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.ActiveConnection = Conn
rs.Open "Select Varenummer, Varetekst, Pris FROM katalog WHERE Varenummer="
& nVarenummer
If rs.EOF And rs.BOF Then
bValid = False
Else
avarProdukt = rs.GetRows ()
End If
Conn.Close
Set rs = Nothing
Set Conn = Nothing
End If
Set XMLDoc = Server.CreateObject ("Microsoft.XMLDOM")
If Not IsEmpty(Session("BagItems")) Then
XMLDOC.loadXML CStr(Session("BagItems"))
Set BagItems = XMLDoc.documentElement
Else
Set BagItems = XMLDoc.createElement("BagItems")
Set XMLDoc.documentElement = BagItems
End IF
If bValid then
Set nodeFind = BagItems.selectNodes("produkt[@Varenummer=""" & nVarenummer &
"""]")
If Not nodeFind.length > 0 Then
Set produkt = XMLDoc.createElement("produkt")
Set attr = XMLDOC.createAttribute ("Varenummer")
attr.Text = avarprodukt(0,0)
produkt.attributes.SetNamedItem(attr)
Set attr = XMLDoc.createAttribute ("Varetekst")
attr.Text = Server.HtmlEncode (avarProdukt(1,0))
produkt.attributes.SetNamedItem(attr)
Set attr = XMLDoc.createAttribute ("Pris")
attr.Text = avarProdukt(2,0)
produkt.attributes.setNamedItem(attr)
produkt.text = "1"
BagItems.appendChild(produkt)
End If
End If
Session("BagItems") = BagItems.XML
Sub Out(strOut)
Response.Write strOut
End Sub
Sub PrintBag(BagItems)
%>
<FORM ACTION ="<% Request.ServerVariables("SCRIPT_NAME")%>" METHOD="POST">
<%
Out "<FORM METHOD=""POST"" ACTION="""
Out Request.ServerVariables("SCRIPT_NAME") & """>"
Out "<TABLE><TR><TH>Units</TH><TH COLSPAN=2>"
Out "produkt</TH><TH>Pris</TH><TH>Pris2</TH>"
Out "</TR>" & vbCrLf
For Each item In BagItems.childNodes
Out "<TR><TD><input type=""TEXT"" NAME=""Qty"
Out item.attributes.getNamedItem("Varenummer")
Out """ VALUE=""" & item.text & """ SIZE=""3"">"
Out "<TD>" & item.attributes.getNamedItem("Varetekst")
Out "</TD><TD>" & item.attributes.getNamedItem("Varenummer") & "</TD>"
nPris = item.attributes.getNamedItem("Pris")
nSubTotal = item.text * nPris
nTotal = nTotal + nSubTotal
Out "<TD>" & FormatCurrency(nPris) & "</TD>"
Out "<TD><B>" & FormatCurrency (nSubTotal) & "</B></TD>"
Out "</TR>" & vbCRLF
Next
Out "<TR><TD COLSPAN=5><HR></TD></TR>"
Out "<TR><TD COLSPAN=3></TD><TD><B>Total:</B></TD>"
Out "<TD><B>" & FormatCurrency(nTotal) & "</B></TD></TR>" & vbCrLf
Out "<TR><TD COLSPAN=5 ALIGN=""RIGHT"">"
Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Shop for more""> "
Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Recalculate""> "
Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Check out"">"
Out "</TD></TR></TABLE></FORM>"
End Sub
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%Call PrintBag(BagItems)%>
</BODY>
</HTML>
Klaus Egebjerg <klausegebjerg@get2net.dk> skrev i en
nyhedsmeddelelse:iOxi7.18575$3q.603584@news010.worldonline.dk...
> Hej
>
> Jeg har lavet følgende kode som desværre går i fejl. Fejlen ser således
ud:
>
> Response-objekt fejl 'ASP 0185 : 80020003'
>
> Standardegenskab mangler
>
> ?
>
> En standardegenskab for objektet blev ikke fundet
>
>
>
>
> Kode:
>
>
> Session("BagItems") = BagItems.XML
>
> Sub Out(strOut)
> Response.Write strOut
> End Sub
>
> Sub PrintBag(BagItems)
>
> Out "<FORM METHOD=""POST"" ACTION="""
> Out Request.ServerVariables("SCRIPT_NAME") & """>"
> Out "<TABLE><TR><TH>Units</TH><TH COLSPAN=2>"
> Out "produkt</TH><TH>Pris</TH><TH>Pris2</TH>"
> Out "</TR>" & vbCrLf
> For Each item In BagItems.childNodes
> Out "<TR><TD><input type=""TEXT"" name=""Qty"
> Out item.attributes.getNamedItem("Varenummer")
> Out """ VALUE=""" & item.text & """ SIZE=""3"">"
> Out "<TD>" & item.attributes.getNamedItem("Varetekst")
> Out "</TD><TD>" & item.attributes.getNamedItem("Varenummer") & "</TD>"
> nPris = item.attributes.getNamedItem("Pris")
> nSubTotal = item.text * nPris
> nTotal = nTotal + nSubTotal
> Out "<TD>" & FormatCurrency(nPris) & "</TD>"
> Out "<TD><B>" & FormatCurrency (nSubTotal) & "</B></TD>"
> Out "</TR>" & vbCRLF
> Next
> Out "<TR><TD COLSPAN=5><HR></TD></TR>"
> Out "<TR><TD COLSPAN=3></TD><TD><B>Total:</B></TD>"
> Out "<TD><B>" & FormatCurrency(nTotal) & "</B></TD></TR>" & vbCrLf
> Out "<TR><TD COLSPAN=5 ALIGN=""RIGHT"">"
> Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Shop for more""> "
> Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Recalculate""> "
> Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Check out"">"
> Out "</TD></TR></TABLE></FORM>"
>
> End Sub
> %>
>
> <HTML>
> <HEAD>
> </HEAD>
> <BODY>
> <%Call PrintBag(BagItems)%>
> </BODY>
> </HTML>
>
>
>
>