Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 General help me questions
 SQL not displaying anything?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SideFFect
Starting Member

Canada
4 Posts

Posted - August 09 2007 :  11:57:06  Show Profile  Visit SideFFect's Homepage  Reply with Quote
Hey guys, I just started working on my boss's website and he uses the VP-ASP cart program.

I didn't get any information on it however, so was forced to try to understand all the main files by myself...has been...entertaining to say the least.

Anyways, I am trying to access the DB to retrieve items for display on the default.asp page

My code looks like this:

<table border="2" cellspacing="0" cellpadding="0">
<tr><td>
<% Dim dbc
InitializeSystem
ShopOpenDatabaseP dbc
CheckDatabaseOpen dbc
Showprod
ShopCloseDatabase dbc

Sub ShowProd()
Dim rs
dim catalogid
SQL="Select cname from products where catalogid = 9"
set rs = dbc.execute(SQL)

OpenRecordSet dbc, rs, sql
While Not rs.EOF
catalogid=rs("catalogid")
rs.MoveNext
Wend

response.write "</center></table>"
CloseRecordSet rs
end sub

%></td></tr></table>

This is just under the include files and an already placed <%InitializeSystem%> command.

Problem is, when I try the page, I get a HUGE space where the table should be and my products that were listed normally on default.asp get pushed WAY down.

If I change anything I get an Internal 500 error.

Is there anything wrong with my code?
Any advice/tips are welcome!

Thanks,

- SideFFect -

SideFFect
Starting Member

Canada
4 Posts

Posted - August 09 2007 :  12:03:11  Show Profile  Visit SideFFect's Homepage  Reply with Quote
Sorry I meant SQL = "Select * from products where catalogid=9"

and it then shows the huge space and a tiny black box where the table should be (except for the fact that nothing is being retrieved from the database)

Thanks again!
Go to Top of Page

SideFFect
Starting Member

Canada
4 Posts

Posted - August 09 2007 :  12:11:46  Show Profile  Visit SideFFect's Homepage  Reply with Quote
Wow, I think I got it! (and I didn't have the set rs = dbc.execute(SQL) before in order for it to work, sorry about the confusion)

I deleted:

While Not rs.EOF
catalogid=rs("catalogid")
rs.MoveNext
Wend

Changed SQL= Select cname from products where catalogid=9
and
response.write rs("cname")

And it FINALLY displayed the name in my table!
Jesus that took long to grasp lol
Go to Top of Page

support
Administrator

4679 Posts

Posted - August 14 2007 :  22:59:45  Show Profile  Visit support's Homepage  Reply with Quote
You could try using the folllwing instead of custom coding:

[Add_randomproducts]

This will allow you to display products from the database on the home page.

You can download our user Guide from:
http://www.vpasp.com/helpnotes

Thanks
Cam

VP-ASP Support
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00