Forum Moderators: open
This will print what ever my?string was on the URL
<%=Request.QueryString("myString")%>
problem is I need to insert this inbetween a piece of code
EG:
<%
VARIOUS CODE FUNCTIONS
VARIOUS CODE FUNCTIONS
VARIOUS CODE FUNCTIONS
<%=Request.QueryString("salutation")%>
VARIOUS CODE FUNCTIONS
VARIOUS CODE FUNCTIONS
VARIOUS CODE FUNCTIONS
%>
when I do I get an error presumably because Im starting a new bracket in the middle of a function how do I get around this.
Kind Regards
Walker
Response.Write Request.QueryString("salutation")
The "=" is basically a shortcut for saying "Response.Write".
You can also do:
Response.Write "this is a nice day"
This will display text.
Finally, you can combine both of these by using the "&" sign:
Response.Write "Saluation is " & Request.QueryString("salutation")
Hope this helps
Thanks, I'm half way there but have now encouned a new problem
Here is the whole line ( currently prompting an error)
Set rstSimple = cnnSimple.Execute("SELECT * FROM employees WHERE FirstName= Response.Write Request.QueryString("salutation") ORDER BY EmployeeID")
Here is the hardcoded version that does work.
Set rstSimple = cnnSimple.Execute("SELECT * FROM employees WHERE FirstName= 'walker'ORDER BY EmployeeID")
I now assume its due to the double(
Any further assistance would really be appreciated.
Kind Regards
Rod
I think it may work if you change the line to:
Set rstSimple = cnnSimple.Execute("SELECT * FROM employees WHERE FirstName=Request.QueryString("salutation") ORDER BY EmployeeID")
Also,
I sometimes find it makes things easier if you break it into two seperate statements (but I'm NOT sure if this works ok with the excute statements):
VarFirstName=Request.QueryString("salutation")
- the above line loads your value into a variable called VarFirstName.
Then:
Set rstSimple = cnnSimple.Execute("SELECT * FROM employees WHERE FirstName=VarFirstName ORDER BY EmployeeID")
cnnSimple.Execute() ist just a string (to asp). So in order to get your stuff to work, you should at least seperate your static part of the SQL statement from the variable as in Set rstSimple = cnnSimple.Execute("SELECT * FROM employees WHERE FirstName= '" & VarFirstName & "' ORDER BY EmployeeID") or in a more readable form:
Dim strSQL
[...]
strSQL = "SELECT * FROM employees "
strSQL = strSQL & "WHERE FirstName= '" & VarFirstName & "' "
strSQL = strSQL & "ORDER BY EmployeeID"
cnnSimple.Execute(strSQL)
If your string-delimiter in SQL is a double quote (instead of a single quote as used in the above example), then the statement would be:
Dim strSQL
[...]
strSQL = "SELECT * FROM employees "
strSQL = strSQL & "WHERE FirstName= """ & VarFirstName & """ "
strSQL = strSQL & "ORDER BY EmployeeID"
cnnSimple.Execute(strSQL)