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

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 December 17th, 2003, 04:21 AM
MyFirstASP MyFirstASP is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 MyFirstASP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy count number of search results

Hi all,

I'm a newbie in ASP here and I need some help from those experts out there

I'm trying to display the total number of records for every different items from a search result. Say that in my access DB there is a field called Products. In it is stored 4 different kinds of products (Prod A, Prod B, Prod C and Prod D). Lets say the total number of records in the DB for each products are:

Products----Total
Prod A--------3
Prod B--------6
Prod C-------32
Prod D-------1

Say I typed in some name that starts with 'M' in the search field. The search results will be:

Name------------Products
Mr. W--------------Prod A
Ms. X-------------Prod A
Mrs. Y--------------ProdC
Ms. Z------------Prod B

Now I have to create a table in my ASP page where it displays something like below:

Products------Totals_From_Search_Results
Prod A---------2
Prod B--------1
Prod C--------1
Prod D--------0

Do you think this is possible? I'm using Access/ASP and am totally stumped. Hope to hear from u guys soon~

Reply With Quote
  #2  
Old January 1st, 2004, 02:41 PM
Skip's Avatar
Skip Skip is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: UK
Posts: 816 Skip User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 21 m 47 sec
Reputation Power: 6
Well ermm Im not sure what it is you want to achive and you have some issuses with your Db design Name is a reserved word so you should change this to something like Seller_Name

*Arghhg

Brains gone :¬|

Ill think of somthing and repost in a sec

Last edited by Skip : January 1st, 2004 at 02:50 PM.

Reply With Quote
  #3  
Old January 1st, 2004, 03:44 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 15th Plane (12000 - 12499 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 12,025 Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 12 h 15 m 49 sec
Reputation Power: 628
post what your database structure looks like.
Tables, fieldNames, etc...

Reply With Quote
  #4  
Old January 4th, 2004, 07:59 PM
MyFirstASP MyFirstASP is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 MyFirstASP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi guys,

Forgot to say I've found the solution a couple of days ago. Sorry for taking your time. Anyone interested can take a look at the codes I used below. Found it in some website. Cheerio!


<%
call query2table("SELECT Field1, COUNT(Field1) AS Search FROM MyTableName WHERE " & u_where &" LIKE '%%"& u_search & "%%' GROUP BY Field1")
%>

<%
sub query2table(inputquery)
DIM conntemp,myPath
SET conntemp = Server.CreateObject("ADODB.Connection")
myPath = Server.MapPath("database.mdb")
conntemp.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & myPath & ";"

SET rstemp=conntemp.execute(inputquery)
howmanyfields=rstemp.fields.count -1%>

<table width="36%" border="0" cellspacing="1" cellpadding="2" height="161">
<tr>
<td height="98">
<table border=1 bordercolor="#000066" bgcolor="#0066CC" align="center">
<tr>
<% 'Put Headings On The Table of Field Names
for i=0 to howmanyfields %>
<td><b><font color="yellow"><%=rstemp(i).name%></font></b></td>
<% next %>
</tr>
<% ' Now lets grab all the records
do while not rstemp.eof %>
<tr>
<% for i = 0 to howmanyfields
thisvalue=rstemp(i)
If isnull(thisvalue) then
thisvalue="&nbsp;"

end if%>
<td valign=top><%=thisvalue%></td>
<% next %>
</tr>
<%rstemp.movenext
loop%>
</table>
<%
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
end sub%>
<div align="center"><b></b></div>
<div align="center"></div>
</td>
</tr>
</table>

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > count number of search results


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 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek