Click to See Complete Forum and Search --> : Help me pleeeeeze!!!!


Arizona
08-07-2006, 11:06 AM
Hi...I'm new here and am terrible at explaining things so please bare with me...

I'm trying to get a products page up and running for a project site. This is the asp code for the two pages needed so far:

PAGE 1:

<%
Dim mySQL, myRS
Set myRS = Server.CreateObject("ADODB.Recordset")
mySQL = "SELECT CategoryID, Category FROM Categories"
myRS.Open mySQL, myConn
Response.Write "<p>Product Categories:</p><p class='tiny'>"
Do While Not myRS.EOF
Response.Write "<a href='category.asp?CategoryID=" &_
myRS("CategoryID") & "&CartID=" & CartID &_
"'>" & myRS("Category") & "</a><br>"
myRS.MoveNext
Loop
Response.Write "</p>"
myRS.Close
%>

PAGE2:

<%
Dim mySQL, myRS, CategoryID
CategoryID = CInt(Request.QueryString("CategoryID"))
mySQL = "SELECT ProductID, Title, Price, Category " &_
"FROM Products " &_
"WHERE Products.CategoryID = " & CategoryID
Set myRS = Server.CreateObject("ADODB.Recordset")
myRS.Open mySQL, myConn
Response.Write "<p>The products in the category of <b>" &_
myRS("Category") & "</b> are shown below:"
While Not myRS.EOF
Response.Write "<p><big><b><a href='shopping(prod.asp?ProductID=" &_
myRS("ProductID") & "&CartID=" & CartID & "'>" & myRS("Title") & "</a></b></big><br>"

Response.Write "<b>Catalog Code:</b> " & myRS("ProductID") &_
" <b>Price:</b> $" & FormatNumber(myRS("Price"),2) & "</p>"
Call AddToCartForm
myRS.MoveNext
Wend
%>

However I keep getting the error:
Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/ISPD/category.asp, line 26

Line 26 is:

myRS.Open mySQL, myConn

I really dont understand where I'm going wrong. :(

Can anyone help me...sorry if I haven't explained very well...

lmf232s
08-07-2006, 12:02 PM
Also what is the value of myConn? There is a chance that this is not populated

Arizona
08-07-2006, 12:06 PM
Hi
The value of myConn is below. It is set as an include in both pages. Not sure what you mean by populated though.

<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->

<%
Dim cPath, myConn
cPath = Server.MapPath("ISPD.mdb")
myConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & cPath & ";"
%>

I'll add <% Option Explicit %> now and see if it helps...

sleven
08-07-2006, 10:13 PM
like this

<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->

<%
Dim cPath, myConn
' Open Connection to the database
set myConn = Server.CreateObject("ADODB.Connection")
cPath = Server.MapPath("ISPD.mdb")
myConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & cPath & ";"
%>