Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am currently building a small database driven website .

 

This website has a search function which firstly utilises javascript and drop down menus. i.e. the user selects from the 1st drop-down menu, which then populates the 2nd menu. The user then selects from this menu which then populates the third and final menu. User then selects from this and submits.

 

I want the nect page to take the information from each of the drop-down menu selections and search my MS access database for the available product.

 

The following is the code I have for my asp page which is for searching the DB

 

<HTML>

<TITLE> Search Results ------ BUY</TITLE>

<BODY>

<B>Here are the Products available:<B><BR>

<%

 

'Get the variable from the drop down menu

 

Request.Querystring("firstChoice")

Request.Querystring("secondChoice")

Request.Querystring("thirdChoice")

 

 

'build SQL statement - get from the MS Access DB all the details on the product selected in the drop-down menu

 

SQL_query = "SELECT * FROM products WHERE Flow_Cv = '" & Request.Form("firstChoice") & "' AND Orifice_size = '" & Request.Form("secondChoice") & "' AND Port_Connection = '" & Request.Form("thirdChoice") & "'"

 

 

'Create connection name "MyConn"

'Load the resulting recordset into the variable RS

 

Set MyConn = Server.CreateObject("ADODB.Connection")

MyConn.Open "FILEDSN=c:\dsn\MyProducts_dsn.dsn"

 

Set RS = MyConn.Execute(SQL_query)

WHILE NOT RS.EOF

%>

 

<%Response.Write "Product_id : " & rs("Product_id") & " "%> --------- Click here to BUY<BR><BR>

 

<%

RS.MoveNext

WEND

RS.Close

MyConn.Close

%>

 

 

</BODY>

</HTML>

 

I cant seem to get the sql query returning anything from my DB.

 

Anybody got any ideas?

  • Leaders
Posted

This question is probably more appropriate for this site's sibling: http://www.visualbasicforum.com and the ASP forum specifically.

 

When I'd have problems like this that didn't produce an error, I'd just Response.Write the SQL string then copy and paste it into Access and make sure it *should* return results before you go too far in the error tracking process.

--tim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...