Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 26th, 2005, 03:04 PM
Registered User
 
Join Date: Aug 2005
Location: Hull, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mcloum
Default Filter Help

Hi all,

First time posting here. Been using ASP for about a year but never really got to far into coding. I only learnt enough to get my site up and running as i was on a tight deadline. Im now upgrading the site and need a little help with the "Filte" properties of a RecordSet.

Im trying to group together similar records. Its basically a discography of albums that a band has released. I have been reading the code on chapter 13 page 549 which i could adapt to do what i want it to do but im getting stuck.

Here is the code i have.

Code:
<%@LANGUAGE="VBSCRIPT"%>
<% OPTION EXPLICIT %>
<link rel="stylesheet" href="includes/style.css" type="text/css">




<body bgcolor="#333333">


<% 
    Dim strSQL, ID
'        strSQL = "SELECT Albums.AlbumsID, Albums.Album, Lyrics.LyricsID, Lyrics.Title, Lyrics.AlbumsID FROM Albums LEFT JOIN Lyrics ON Albums.AlbumsID=Lyrics.AlbumsID WHERE Lyrics.Active=1;" 
        strSQL = "SELECT Albums.AlbumsID AS Albums_AlbumsID, Albums.Name AS Albums_Name, Tracks.TracksID, Tracks.AlbumsID AS Tracks_AlbumsID, Tracks.LyricsID, Tracks.TabID, Tracks.Name AS Tracks_Name, Tracks.TrackNumber FROM Albums INNER JOIN Tracks ON Albums.AlbumsID = Tracks.AlbumsID;"

            'Debug lines
            response.write strSQL
            response.flush

            'Open DB connection
            'objRS.CursorType = 3
            objRS.Open strSQL, objConn, adOpenStatic, AdLockReadOnly, adCmdTable
            objRS.Filter = objRS("Albums_Name")

            Dim Count 'We'll use this to limit the number of records displayed on a page
            Count = 1

                        Response.Write "<table border=1 cellpadding=0>"
                        Do While Not objRS.EOF
                                With Response
                                    .Write "<tr class=""body"">"
                                    .Write "<td>"
                                    '.Write (objRS.Fields.Item("tblLyrics.fldTitle").Value)
                                    '.Write (objRS.Fields.Item("tblLyrics.fldAlbum").Value)
                                    .Write objRS("Albums_Name")
                                    .Write "</td><td>"
                                    .Write objRS("Tracks_Name")
                                    .Write "</td><td>"
                                    '.Write "<a href=""LyricsDetailPage.asp?ID=" & objRS("Lyrics.LyricsID") & """> Lyrics</a> "
                                    .Write "</td></tr>"
                            End With
                            count = count + 1
                            'objRS.Filter = nothing
                            objRS.MoveNext
                            Loop
                    Response.Write "<tr><td align=center>"
                    Response.Write "</td></tr></table>"
                    Response.Write  "<center>"
            'Call BuildNav2 (intPrev,IntNext,TotalPages)
            Response.Write "</center>"
objRS.close
Set objRS = Nothing
%> 
</body>
</html>
When i run the page a i get the following error message.

Code:
SELECT Albums.AlbumsID AS Albums_AlbumsID, Albums.Name AS Albums_Name, Tracks.TracksID, Tracks.AlbumsID AS Tracks_AlbumsID, Tracks.LyricsID, Tracks.TabID, Tracks.Name AS Tracks_Name, Tracks.TrackNumber FROM Albums INNER JOIN Tracks ON Albums.AlbumsID = Tracks.AlbumsID;

Microsoft JET Database Engine error '80040e14'

Syntax error in FROM clause.

/beta/lyrics_iframe.asp, line 22
But if i take out the lines "adOpenStatic, AdLockReadOnly, adCmdTable" propertie i get the results printed on the page as expected.

Can someone explain where im going wrong? i've been at this for a few hours and i think i need a fresh pair of eyes.

Many thanks

Mike

  #2 (permalink)  
Old August 26th, 2005, 03:10 PM
Registered User
 
Join Date: Aug 2005
Location: Hull, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mcloum
Default

I should really read my own writing!

The objRS.Filter line isnt commented out (i was testing) And if i take out the lines " adOpenStatic, AdLockReadOnly, adCmdTable" i get the following error also:

Quote:
quote:
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/beta/lyrics_iframe.asp, line 22
This is my main question really. I think im not understanding how to impliment the Filter property

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matrix filter jpenn Reporting Services 0 August 10th, 2006 03:46 PM
Filter Help mcloum Classic ASP Databases 2 November 10th, 2005 05:40 PM
ListBox Filter dgold Access 3 March 30th, 2005 06:00 PM
How to Filter Cr 9.0 abdusalam Crystal Reports 0 June 25th, 2004 02:04 AM
How to filter data? coolest_pie SQL Server 2000 7 May 7th, 2004 07:00 PM



All times are GMT -4. The time now is 06:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.