You are here Support Forums
Search:  
error using querystring value
Last Post 19 Oct 2007 03:01 AM by Duncan Watson. 6 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Kristin Induni
New Member
New Member
Posts:8

--
13 Dec 2004 10:49 AM  

I set up the newest version with a very complex sql query and tried to make use of the querystring token without success.

Is there a way you could post an example query to make sure I am using the syntax right?

Thanks

midspot

Richard Edwards
DNNStuff Founder
Veteran Member
Veteran Member
Posts:1207
Avatar

--
13 Dec 2004 11:12 AM  

Here's an example that uses the tabid query string parameter,

select * from tabs where tabid = [QUERYSTRING:tabid]

Now, if the page url is the following,

http://www.dnnstuff.com/Default.aspx?tabid=166

then the resulting SQL will be,

select * from tabs where tabid = 166

Does this help at all?

Richard



Richard Edwards
DNNStuff Founder
Did you receive excellent support? Consider leaving a testimonial
Kristin Induni
New Member
New Member
Posts:8

--
22 Dec 2004 09:57 AM  

how about a like statement? I would like to create an employee phone number search...

I would like to formulate a string as such to execute: http://www.mysite.com?defualt.aspx?tabid=37&sern=Jo

This is what I have so far (connects to another db):

SELECT     TOP 100 PERCENT Emp_First_Name + ' ' + Emp_Last_Name AS Name, Office_Phone_1 AS Phone, Office_Email AS Email, Job_Title AS Title,
                      Department AS Department, Company AS Company
FROM         (SELECT DISTINCT
                                              Employee_ID, Company, Location, Department, Emp_First_Name, Emp_Initial, Emp_Last_Name, NickName, Job_Title, Office_Phone_1,
                                              OPhone1_ext, Office_Phone_2, OPhone2_ext, Home_Phone_1, Home_Phone_2, Cell_Phone, Pager_Phone, Person_Fax_Phone,
                                              Dept_Fax_Phone, Office_Email, Home_Email
                       FROM          phonedir_wbi
                       UNION
                       SELECT DISTINCT
                                             Employee_id, Company_id, Location_id, department_id, Emp_First_Name, Emp_Initial, Emp_Last_Name, NickName, Job_Title,
                                             Office_Phone_1, OPhone1_ext, Office_Phone_2, OPhone2_ext, Home_Phone_1, Home_Phone_2, Cell_Phone, Pager_Phone,
                                             Person_Fax_Phone, Dept_Fax_Phone, Office_Internet_add, Home_Internet_add
                       FROM         tblEmployee) DERIVEDTBL WHERE
(Emp_Last_Name LIKE '%" & [QUERYSTRING:sern]  & "%' OR Emp_First_Name LIKE '%" & [QUERYSTRING:sern]  & "%' OR Office_Email LIKE '%" & [QUERYSTRING:sern]  & "%' OR Job_Title LIKE '%" & [QUERYSTRING:sern]  & "%' OR Department LIKE '%" & [QUERYSTRING:sern]  & "%' OR Company LIKE '%" & [QUERYSTRING:sern] & "%' OR Office_Phone_1 LIKE '%" & [QUERYSTRING:sern] & "%')

 

thanks

midspot

Richard Edwards
DNNStuff Founder
Veteran Member
Veteran Member
Posts:1207
Avatar

--
22 Dec 2004 02:15 PM  
Yes, that should work fine except for a small modification to your where clause. You don't have to do any appending at all, just place the [QUERYSTRING:sern] right where you need it in your sql clause.

SQLView does a direct replacement of [QUERYSTRING:sern] with the value for sern in the querystring, in your example 'jo'. Therefore, the clause LIKE '%[QUERYSTRING:sern]%' would be LIKE '%jo%' after the replacement is made.

Something like this would work:

(Emp_Last_Name LIKE '%[QUERYSTRING:sern]%' OR Emp_First_Name LIKE '%[QUERYSTRING:sern]%' OR Office_Email LIKE '%[QUERYSTRING:sern]%' OR Job_Title LIKE '% [QUERYSTRING:sern]%' OR Department LIKE '%[QUERYSTRING:sern]%' OR Company LIKE '%[QUERYSTRING:sern]%' OR Office_Phone_1 LIKE '%[QUERYSTRING:sern]%')

Richard Edwards
DNNStuffAdmin


Richard Edwards
DNNStuff Founder
Did you receive excellent support? Consider leaving a testimonial
Kristin Induni
New Member
New Member
Posts:8

--
22 Dec 2004 02:48 PM  
works like a charm! thanks
steve
New Member
New Member
Posts:9

--
17 Oct 2007 12:02 AM  
Hello, can you please tell me which form or custom module, that will postback the page with the querystring parameter, do you use? Thank you
Duncan Watson
New Member
New Member
Posts:4

--
19 Oct 2007 03:01 AM  
You don't need any form or custom mod. Just put the html code in a string and put in a select statement. ie.
Select
'<P align=right><A href="http://www.jigsaw.net/portal/Recognition/MonthlyAwards/tabid/65/Default.aspx?'
+'t1='
+rtrim(convert(char,@NextAuditID))
+'" title="Click to show Next Period Awards">'
--Show Next Period
+'<IMG src="http://www.jigsaw.net/Portal/Portals/0/Icon_btn_next.gif" border=0 align=absMiddle title="Show Awards for Next Period">'
+'</A></P>'
as [ ]
You are not authorized to post a reply.

Active Forums 4.1
Privacy StatementTerms Of UseCopyright (c) 2004-2012 DNNStuff