View Full Version : mysql and record setting

07-16-2008, 03:01 AM
Hi there,

I am trying to define my page to get a value from the URL in asp. I have doen the following to connect and define my record set to get the table that all the information is in and display it in order. The following is the code

Dim rsProdDetail__varProduct
rsProdDetail__varProduct = "Request.QueryString("productID")"
If (BVAL <> "") Then
rsProdDetail__varProduct = BVAL
End If
Dim rsProdDetail
Dim rsProdDetail_cmd
Dim rsProdDetail_numRows

Set rsProdDetail_cmd = Server.CreateObject ("ADODB.Command")
rsProdDetail_cmd.ActiveConnection = MM_DMICSQL_STRING
rsProdDetail_cmd.CommandText = "SELECT SER_ID_Name, SER_ID, Header, SubHeader, Disclaimer, Section, Pic_UNC, Paragraph, Bullets FROM dbo.F01_Products_Detail, dbo.F01_Products WHERE dbo.F01_Products_Detail.SER_ID=dbo.F01_Products.SE R_ID_Name AND dbo.F01_Products_Detail.SER_ID=?"
rsProdDetail_cmd.Prepared = true
rsProdDetail_cmd.Parameters.Append rsProdDetail_cmd.CreateParameter("param1", 200, 1, 255, rsProdDetail__varProduct) ' adVarChar

Set rsProdDetail = rsProdDetail_cmd.Execute
rsProdDetail_numRows = 0

It's suppose to get the value that is passed through the URL and sort the record set according to that. When I did the code in mysql and executed it it was fine all I did was replace '.SER_ID=?' with a value that its suppose to get from the URL. Am I doing something newbish wrong? The error that is coming up says that
rsProdDetail__varProduct = "Request.QueryString("productID")"

is expecting end statement but there is an end if statement as you can see. Any help is welcomed!

Thanks for your help!

08-12-2008, 09:07 AM
You want to pass and get a value in the URL?
Pass the value;
sompage.asp?id=<id from db>
Get the value;
In the getpage.asp page
= Request.QueryString("id")
Dim urlval
urlval = Request.QueryString("id")
dbselect statement;
"SELECT * FROM table WHERE id = urlval"

This is all untested, just an idea.

08-12-2008, 01:03 PM
hey student101 thanks for the reply but i figured out what I was doing wrong. Since I was using dreamweaver to do the mysql record set for me it put this is

rsProdDetail__varProduct = "Request.QueryString("productID")"

This is wrong because the "" are not suppose to be around "Request and at the last )" . They are only suppose to be in "productID". This is why i agree with davidj that people should learn to write their own code instead of using DW to do it because it usually messes something up.