11 Replies - 1023 Views - Last Post: 16 May 2012 - 08:28 AM

#1 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Active server page Code Problem!

Posted 16 May 2012 - 05:42 AM

Hello, I'm trying to do a webshop/shopcart in ASP with Dreamweaver and Access 2007. Currently if I press "Shirts" It comes up "information" "price" and "amount". That works perfect. But I get problem when I want to watch what I have in my Shopcart. This is the code atm:

Shopcart_show.asp

<html>
 
<% 
If Request.QueryString("Status") = "laggtill" Then
Antal = Request.QueryString("Antal")
Besk = Request.QueryString("Besk")
%>
 
Du har lagt till <%=Antal%> st <%=Besk%> i kundvagnen.
 
<% 
Elseif Request.QueryString("Status") = "tagitbort" Then
Besk = Request.QueryString("Besk") 
%>
 
Du har tagit bort <%=Besk%> från kundvagnen.
 
<% 
End If 
%>
 
 
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("Database.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")

Sessionen = Session.SessionID
rs.Open "SELECT * FROM TemporaryShopping WHERE SID='" & Sessionen & "'", conn, 4, 4

If rs.EOF = True Then  %>
<p><b>Kundvagnen är tom.</b>
<% 
Else 
%>
 
<a href="Shopcart.asp?status=1" target=”_top”>Gå till kassan</A>
<table width=97% bgcolor=Silver>
<TR>
<td>Vara</td>
<td>Antal</td>
<td>Pris</td>
<td align="right">Ta bort från kundvagnen</td>
</TR>
 
                                           
<% 
Do Until rs.EOF
ant = rs("Amount")
prs = rs("Price")
Summa = ant * prs
%>
 
<form method = "get" action = "Shopcart_delete.asp">
<tr>
  <td align = "Left"><%=rs("Info")%></td>
  <td align = "Left"><%=rs("Amount")%></td>
  <td align = "Left"><%=Summa%> kr</td>
  <td align="right">
  <input name="submit1" type="submit" value="Tabort"></td>
  <td><Input type = "hidden" value = "<%=rs("Info")%>" name = "Besk"></td>
  <td><Input type = "hidden" value = "<%=rs("AID")%>" name = "ArtNr"></td>
  <td><Input type = "hidden" value = "<%=Sessionen%>" name = "Sessionen"></td>
  <td><Input type = "hidden" value = "tabort" name = "andra"></td></form>
</tr>
</table>                                           
<% 
rs.MoveNext 
Loop 

Session("From") = "visa"

rs.Close
conn.Close 
set rs=nothing
set conn=nothing

End If
%>
</html>


Some words are Swedish, so if you don't understand I'd be more then glad to explain!

Thank you c:

Is This A Good Question/Topic? 0
  • +

Replies To: Active server page Code Problem!

#2 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Active server page Code Problem!

Posted 16 May 2012 - 06:16 AM

View Postekenn123, on 16 May 2012 - 12:42 PM, said:

That works perfect. But I get problem when I want to watch what I have in my Shopcart.

What is the problem, exactly? Can you describe what is, or is not, happening correctly?


One question, though. Why are you using Classic ASP? It's a fairly out of date language that is no longer being developed by Microsoft, and there are far superior alternatives around. Most people would be using/learning ASP.NET, PHP or JSP for server-side scripting these days.

Also, Access is not a great database for website development. From what I've read (having never used it myself) it is more geared towards single user desktop applications, and doesn't handle the loads websites tend to get very well. You'd probably do better to use something like Microsoft SQL Server (the express version is free), MySQL or PostgreSQL.
Was This Post Helpful? 0
  • +
  • -

#3 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Re: Active server page Code Problem!

Posted 16 May 2012 - 06:30 AM

It only shows this line:
Du har lagt till <%=Antal%> st <%=Besk%> i kundvagnen.


Then the standard error code:An error has occured blabla.

I use it because this is actually a project at school and my teacher told me to use it :)
Was This Post Helpful? 0
  • +
  • -

#4 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Active server page Code Problem!

Posted 16 May 2012 - 06:56 AM

View Postekenn123, on 16 May 2012 - 01:30 PM, said:

Then the standard error code:An error has occured blabla.

Looks like you need to configure the server to show you the error messages, so you can properly debug the code. What OS and IIS version are you using?

View Postekenn123, on 16 May 2012 - 01:30 PM, said:

I use it because this is actually a project at school and my teacher told me to use it :)

You should ask your teacher why he's teaching you such an outdated technology. It would make much more sense to teach PHP or ASP.NET. You may actually need to use those at some point. :smartass:
Was This Post Helpful? 0
  • +
  • -

#5 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:11 AM

7.5 (i think)

Well, I said I wanted to make a website. So he said, googo asp! :]
Was This Post Helpful? 0
  • +
  • -

#6 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:18 AM

Okey, I fixed so I can see debug/errors

It said line 35, which contains this:
rs.Open "SELECT * FROM TemporaryShopping WHERE SID='" & Sessionen & "'", conn, 3, 3

Was This Post Helpful? 0
  • +
  • -

#7 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:31 AM

Did you get an error message with that?

Looks like you may be using the wrong method there. If you look through the code here, you see that they use .Open to open a connection, and .Execute to execute a query.


View Postekenn123, on 16 May 2012 - 02:11 PM, said:

Well, I said I wanted to make a website. So he said, googo asp! :]

You sure he didn't mean ASP.NET? These days people tend to just say "ASP" for ASP.NET and "Classic ASP" for what you're using :P
Was This Post Helpful? 0
  • +
  • -

#8 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:35 AM

Thanks. But it said The object doesn't support that attribute or method.: 'rs.Execute' (translated to english :))

Uhm, he gave me an ASP book. (Old one) Is ASP.net meant for webprogramming(?) isn't it a program like C++ / Java? :)

EDIT: I changed this:
rs.Open "SELECT * FROM TemporaryShopping WHERE SID='" & Sessionen & "'", conn, 3, 3


rs.EOF = True Then



to this:

rs.Open "SELECT * FROM TemporaryShopping WHERE SID=" & Sessionen, conn, 1


and
rs.EOF = False Then


It works, but it doesn't show my Shopcart, what's in it.

This post has been edited by ekenn123: 16 May 2012 - 07:44 AM

Was This Post Helpful? 0
  • +
  • -

#9 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:51 AM

I was thinking more like this, but I can't be sure. I'm just going of what little I've seen of ASP code online. (I've only used it like once, 10 years ago.)
Set rs = conn.Execute("<insert SQL statemet>")


Was This Post Helpful? 0
  • +
  • -

#10 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:55 AM

I start to believe something is wrong with my Add Page..
Was This Post Helpful? 0
  • +
  • -

#11 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Active server page Code Problem!

Posted 16 May 2012 - 07:56 AM

View Postekenn123, on 16 May 2012 - 02:35 PM, said:

Is ASP.net meant for webprogramming(?) isn't it a program like C++ / Java? :)

Yes, ASP.NET is what Microsoft meant to replace the Classic ASP you are currently using. It uses the .NET framework, so you can choose to use either C# or VB.NET. - See more info on that here. They've made it pretty easy to start working on ASP.NET sites.
Was This Post Helpful? 0
  • +
  • -

#12 ekenn123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 19-January 12

Re: Active server page Code Problem!

Posted 16 May 2012 - 08:28 AM

I see, but I've gotten so far. Atleast I feel like I have.. C:

I fixed login and register and I've only missing some pieces I think to complete this webshop/shopcart. And then I'm done.

So start over from the beginning sounds pretty far away. However if I'm going to do websites next time I'm going to go with ASP.net :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1