|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help me plzzzz
I'm a newbie in ASP. I doing my project and get an error, hard to improve.It's run but not appear anything
<% Dim adoCon 'Holds the Database Connection Object Dim rsAddComments 'Holds the recordset for the new record to be added Dim strSQL 'Holds the SQL query to query the database Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("add_to_newuser.mdb") Set rsAddComments = Server.CreateObject("ADODB.Recordset") set category=trim(Request("Pro_type")) strSQL = "SELECT * FROM Products WHERE Pro_type='"+category+"'" rsAddComments.Open strSQL, adoCon do While not rsAddComments.eof %> <tr> <td height="135" width="115"><IMG scr='<%=rsAddComments("Pro_img")%>'></td> <td height="135" width="181"> <a href = Details.asp?Pro_code=<%rsAddComments("Pro_code")%>> <b><%=rsAddComments("Pro_name")%></b> </a><br> <%=rsAddComments("Pro_des")%> <br> <img src="image/saleTag1.gif" width="57" height="32"> <br> <%=rsAddComments("Price")%> $ <br> <%=rsAddComments("Pro_code")%> <br> <a href=ShoppingCart.asp?option=add&id=<%=rsAddComments("Pro_Id")%> > <img src="image/order.gif" width="55" height="15"> </a> </td> </tr> <% rsAddComments.MoveNext Loop rsAddComments.Close %> So anyone can help me !!!(I want show Product image,Product code, Price ) |
|
#2
|
||||
|
||||
|
Post your error.
Before seeing the error, I'd like to take a good guess that this: Code:
strSQL = "SELECT * FROM Products WHERE Pro_type='"+category+"'" is causing the error. It should be: Code:
strSQL = "SELECT * FROM Products WHERE Pro_type='"&category&"'"
__________________
................... ASCII and ye shall receive .................. Knowledge is the only resource on earth that multiplies when shared Support the Shemzilla Project Powered by C# |
|
#3
|
||||
|
||||
|
a good way to debug these type of errors is to put this code right after the strSQL = "....." statement:
Code:
response.write strSQL response.end this will let you know what connection object is trying to send as your SQL request. |
|
#4
|
|||
|
|||
|
i'm edited but it's still got another error
likes this Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: '[string: "Bakery"]' /project/linktocatalogue.asp, line 9 this is my whole code and database: http://s35.yousendit.com/d.aspx?id=0UQZD382Y14BE2HQHT7AGS9XWF help me plzzzz. |
|
#5
|
||||
|
||||
|
In your code, I didn't see where the field Pro_Type is coming from.
set category=trim(Request("Pro_type")) You must have a page where you provide your users with the description of your products. Code:
<html>
<body>
<form name="main" action="linktocatalogue.asp" method="post">
Please Choose a product type
<br />
<select name="Prod_Type" onChange="this.form.submit();">
<option>Please Select One</option>
<%
Dim rs
Dim con
Set rs = Server.CreateObject("ADODB.Recordset")
Set con = Server.CreateObject("ADODB.Connection")
con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("add_to_newuser.mdb")
Sql = "Select Pro_Type from Products"
rs.open Sql, con
While not rs.eof
Response.Write "<option value=" & rs("Pro_Type") & ">" & rs("Pro_Type") & "</option>"
rs.MoveNext
Wend
'reclaim system resources
rs.close
con.close
Set rs = Nothing
Set con = Nothing
%>
</form>
</body>
</html>
Save this as "selectProduct.asp" then change this portion of lintocatalogue: Code:
set category=trim(Request("Pro_type"))
to: Code:
set category=Request.Form("Pro_type")
|
|
#6
|
|||
|
|||
|
sorry, it's not on my ways.When you run defaut.asp, the main page is open include all pro_type, the pro_type on defaut.asp will refer to catelogue.asp to show all the pro_type like pro_name,pro_dis,pro_image and Price in which mouse click.Thanks lewy but on my way is different.My ideal likes this site : http://www.efaucets.com/brizo-faucets.asp when you click on Kitchen - one handle , the next page will show all thing on one handle likes http://www.efaucets.com/search_results.asp?txtsearchParamTxt=&txtsearchParamType=ALL&txtsearchParamCat=2&txtsearchParamMan=25&txtsearchParamVen=ALL&txtPriceStart=&txtPriceEnd=&txtFromSearch=fromSearch&iLevel=1&btnSearch.x=50&btnSearch.y=9, I want do like that, help me one more times , plzzz
|
|
#7
|
||||
|
||||
|
Quote:
The search works good on this site, What do you have in mind? |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Help me plzzzz |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|