ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 6th, 2009, 01:03 PM
mangofreak mangofreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 23 mangofreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 3 m 7 sec
Reputation Power: 0
How can I accomplish this?

Hi All,

A have a list of links that are painted from a db table called Segments. Which are just a list of categories. Also I have a table of companies which belong to one of the Segments.

Some of the categories have too many records to show all of them and even paging by 50 records at the time it takes many clicks to go to a desired company. To simplify it I have created a form with a select menu where the user can call companies in by the first letter of their name.

The name of the select is "search" This works fine but it is calling companies from all segments and I only want to call segment 2.

What would be the best way to do it?

when only my list of segments is called, the url looks like this:
http://www.mysite.com/segments.asp

when you select one segment looks:
http://www.mysite.com/segments.as?id=2

when you call the companies by letter:
http://www.mysite.com/segments.as?search=m


How can I make it so the url shows:
http://www.mysite.com/segments.as?id=2&search=m


help!!! Any idea or direction.

my code looks like this:

Code:
<%
Dim rsCompanies__Param
rsCompanies__Param = "%"
If (Request.QueryString("id")   <> "") Then 
rsCompanies__Param = Request.QueryString("id")
End If
%>

<%
Dim rsCompanies__Param1
rsCompanies__Param1 = "%"
If (Request.QueryString("search")        <> "") Then 
  rsCompanies__Param1 =  Request.QueryString("search")
End If
%>
<%
Dim rsCompanies
Dim rsCompanies_cmd
Dim rsCompanies_numRows

Set rsCompanies_cmd = Server.CreateObject ("ADODB.Command")
rsCompanies_cmd.ActiveConnection = MM_connoelpages07_STRING
rsCompanies_cmd.CommandText = "SELECT intCompanyID, intSegment, txtCompany, txtWebsite, txtSegment FROM AllCompanies, tblSegments WHERE intSegment = intSegmentID AND intSegmentID LIKE ? AND bitShow = 1 AND txtCompany LIKE ? ORDER BY txtCompany" 
rsCompanies_cmd.Prepared = true
rsCompanies_cmd.Parameters.Append rsCompanies_cmd.CreateParameter("param1", 200, 1, 255, rsCompanies__Param) ' adVarChar
rsCompanies_cmd.Parameters.Append rsCompanies_cmd.CreateParameter("param2", 200, 1, 255, rsCompanies__Param1 + "%") ' adVarChar

Set rsCompanies = rsCompanies_cmd.Execute
rsCompanies_numRows = 0
%>

Reply With Quote
  #2  
Old November 6th, 2009, 04:41 PM
Krandor Krandor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 154 Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level)Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level)Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level)Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level)Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level)Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level)Krandor User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 17 h 15 m 13 sec
Reputation Power: 71
Quote:
Originally Posted by mangofreak
Hi All,

A have a list of links that are painted from a db table called Segments. Which are just a list of categories. Also I have a table of companies which belong to one of the Segments.

Some of the categories have too many records to show all of them and even paging by 50 records at the time it takes many clicks to go to a desired company. To simplify it I have created a form with a select menu where the user can call companies in by the first letter of their name.

The name of the select is "search" This works fine but it is calling companies from all segments and I only want to call segment 2.

What would be the best way to do it?

when only my list of segments is called, the url looks like this:
http://www.mysite.com/segments.asp

when you select one segment looks:
http://www.mysite.com/segments.as?id=2

when you call the companies by letter:
http://www.mysite.com/segments.as?search=m


How can I make it so the url shows:
http://www.mysite.com/segments.as?id=2&search=m


help!!! Any idea or direction.

my code looks like this:

Code:
<%
Dim rsCompanies__Param
rsCompanies__Param = "%"
If (Request.QueryString("id")   <> "") Then 
rsCompanies__Param = Request.QueryString("id")
End If
%>

<%
Dim rsCompanies__Param1
rsCompanies__Param1 = "%"
If (Request.QueryString("search")        <> "") Then 
  rsCompanies__Param1 =  Request.QueryString("search")
End If
%>
<%
Dim rsCompanies
Dim rsCompanies_cmd
Dim rsCompanies_numRows

Set rsCompanies_cmd = Server.CreateObject ("ADODB.Command")
rsCompanies_cmd.ActiveConnection = MM_connoelpages07_STRING
rsCompanies_cmd.CommandText = "SELECT intCompanyID, intSegment, txtCompany, txtWebsite, txtSegment FROM AllCompanies, tblSegments WHERE intSegment = intSegmentID AND intSegmentID LIKE ? AND bitShow = 1 AND txtCompany LIKE ? ORDER BY txtCompany" 
rsCompanies_cmd.Prepared = true
rsCompanies_cmd.Parameters.Append rsCompanies_cmd.CreateParameter("param1", 200, 1, 255, rsCompanies__Param) ' adVarChar
rsCompanies_cmd.Parameters.Append rsCompanies_cmd.CreateParameter("param2", 200, 1, 255, rsCompanies__Param1 + "%") ' adVarChar

Set rsCompanies = rsCompanies_cmd.Execute
rsCompanies_numRows = 0
%>

Just add "AND Segment = 2 " into your SQL statement

Reply With Quote
  #3  
Old November 6th, 2009, 05:12 PM
mangofreak mangofreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 23 mangofreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 3 m 7 sec
Reputation Power: 0
Quote:
Originally Posted by Krandor
Just add "AND Segment = 2 " into your SQL statement


Oh boy. It was right in front of my nose and I didn't see it. Thanks Krandor. Very much appreciated.

Javier

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > How can I accomplish this?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek