Filtering Example using GetRows

This demo illustrates how to use GetRows and Filter to filter a particular column in a Recordset.


A listing of all of the rows in the FAQ table:
How do you convert a string to all uppercase or all lowercase?
How can I determine if a visitor has cookies support enabled in his/her browser?
How can I display dates in a completely custom format (that might not be supported by FormatDateTime)?
How can I page database results N records at a time?
How can I delete an existing cookie?
When I display the result from a TEXTAREA in a Web page, the line breaks are removed. How can I maintain a TEXTAREAs line breaks in an Web page?
How do I extract the contents of an array without knowing the size of the array?
How can I programmatically list the contents of a directory on the Web server?
What scripting languages can utlitize regular expressions?
How can I create a folder (directory) on the Web server?
How can I pop up a message from ASP? An alert box, when something goes wrong. A "confirm" dialog showing details of a record to make sure the user really wants to delete the record?
How can I create a chart or graph that I can display to the user?
How can I display line breaks in an email message?
Can I send emails without using CDONTS?
How can I determine the length of a string (how many characters are in a string)?
How can I find the position of a certain character (or substring) within a string?
How can I return the current date/time?
What is recursion?
What, exactly, is the FileSystemObject?
How can I send an email using CDONTS?
When I put a value from my database into the value of a form text field, only the first word appears in the browser? What am I doing wrong?
For session variables to work, must the Web visitor have cookies enabled?
Why are there certain times when I can use parenthesis when calling a Subroutine, and other times not?
How can I make an argument of a Function or Sub optional?
How can I display Recordset data in an HTML TABLE? How can I get the names of all the fields in a table?
Can I send my output to a different window or frame than the one that asked for the current ASP page?
How can I order the results from a database query?
How can I display all of the cookies/cookie values for a user through a Web page?
Why do I get a type mismatch error from my query? Why do I get the message Syntax error (missing operator) from my query? Why do I get a Too few parameters expected 1 error from my query?
Okay, if I can't do a conditional #include then how can I conditionally include things in an ASP page?
(1) How can I have two dates and select all records that have a date field with a value between those two dates? (2) How can I select all records in a given month?
How can I read the contents of a file, line-by-line, into an array?
How can I retrieve the fields in my form in the order they appear in the form?
How can I eliminate duplicates from a recordset?
How big can my Access Database be?
Using CDONTS, how can I set a Reply To email address?
Will I ruin the performance of my application if I use session variables?
Is there a better way to show debug values from my ASP pages than to Response.Write them in the middle of my page or use a JavaScript alert to pop them up?
How do I find out if a file exists?
Why do I get the message Microsoft JET Database Engine error ' 80040e14' Syntax error in INSERT INTO statement??
Q: How can I round or slide a number to the nearest integer multiple of my choice? (For example rounding 13.3, 22.75 and 6 to the nearest 5 = 15, 25, 5 respectively)
What is Transact-SQL (T-SQL)?
How can I list all of the Application variables on a Web page?
What is CrossPosting? Why is it considered a bad thing?
How do you create a database table through a SQL statement (via an ASP page, perhaps)?
I've seen function definitions that include ByRef and ByVal statements. What are these?
My memo fields show up as blank! OR When I test my memo field for a value and then try to show it only if it is not blank [or only if it contains some string or or or], then when I display it I get nothing!
How can I display all of the contents of a single-dimension array?
How can I determine the position of a particular string in an Array?
How can I capture and use (i.e. save to disk, let the browser download) the output of one of my own ASP pages?
How can I get a count of the number of dimensions in an array?
How can I use RecordSet.GetString to create a drop down list? How about other more complex output using GetString?
How can I find out if a record already exists in a database? If it doesn't, I want to add it.
How can I delete a file from the Web server's file system?
I am performing a currency calculation and would like to display the value as 7.30, but it is showing up as 7.3. How can I force two demial places?
How can I determine the file size of a file on the Web server?
How do I populate an HTML dropdown box from the results of a database table?
Using VBScript, how can I determine if a variable is a valid date or not?
How can I easily display a nicely formatted date variable?
How can I read the contents of a text file through an ASP page?
How can I rename a file on my Web site through an ASP page?
How can I dynamically change the action of a form?
How can I get the path of the system temporary folder? Also, how can I get a filename for a temporary file?
How can I validate an email address using VBscript?
How can I add or subtract time from a date?
Can I disable the use of session variables on an ASP page-by-page basis?
How can I change a string like $51,234.98 into a number (51234.98)
How can I retrieve emails from a service like Yahoo! Mail?
How can I treat some other web page as data on my own site?
Is there a way to replace pattens of text in a string so that the replacement text includes whatever the pattern matches? For example: enclose all words ending in "ing" in tags?
How can I call an executable program from my ASP page?
When I try to do a Reponse.Redirect, it get an error message about "the HTTP headers are already written..." Why? What can I do?
How can I time the execution speed of my ASP pages to the millisecond?
This question comes from Steve: How can I kill one session variable at a time? "I don't want to have to abandon the whole session, just kill off a few session variables that were used?"
**UPDATED 1 April 2002** How do I get the record number of a just added record?
How can I disable the back button?
How can I replace each occurrence of a particular pattern in a string with another pattern?
How can I quickly determine if a string exists within an array?
How can I make inheritable classes in ASP?
How do I send variables and data from client-side JavaScript to server-side ASP?
How can I shuffle a deck of cards or similar set of sequential numbers? How can I reorder a list of things in random order?
I am using Access and getting a 80004005 error (or a [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)' error) when trying to open a connection! How can I fix this problem?
How can I insert Printer Page Breaks in ASP/HTML?
How can I easily work with/manipulate/parse file paths in .NET?
How can I create my own file uploading component?
How do I insert more information into the middle of a text file? How do I delete something from a text file? How do I add to the front of a text file?
How do I dynamically resize an array?
How do I get SQL to accept an apostrophe in various queries, such as when I try to add a user named "O'Brien"?
How can I ensure that a form field has a particular value? (That is, how can I perform form validation?)
I let my users put in search strings for any number of fields. How do I convert their inputs into a usable SQL search string?
Is there a way I can automate the retrieval of a recordset from a database (so I don't have to type the same code over and over)?
How can I convert a string into an array?
How can I use regular expressions to dynamically place delimiters around certain strings?
How can I list all of the existing Session variables for a particular user?
How do I use CASE in Transact SQL?
** UPDATED 24 June 2003 **: Why am I getting "Operation must use an updateable query" errors?
What is the VBScript Integer Division operator and how can it help my code?
When I get a list of all files in a directory via the FileSystemObject, they aren't ordered in any reasonable way. How can I sort the files by name? Or by size? Or by date created? Or...
What is adovbs.inc? Why should I use it? What benefits does it have?
How can I convert binary data into a string?
How can I use regular expressions to help validate that a user-entered value is in a proper format?
How can I have my ASP page send HTML-formatted email?
How can I tell what version of ADO I am using?
How do you send email attachments through an ASP page?
How can I determine the upper or lower bounds of an array?
How can I validate an email adress using Jscript?
How can I convert the contents of an array into a string?
How can I copy a file using ASP?
How can I conditionally #include files? How can I tell if a file is already #included so I won't include it again? How do #include files work?
How can I pick random records from a table?
How can I run a stored procedure from ASP using only the ADO connection object?
How can I quickly sort a VBScript array?
How can I sort a VB Script array in ways other than by case-sensitive alphanumeric order, like numeric value, length of string, or even randomly?
How can I perform a Reverse DSN Lookup through ASP?
Can I create an application-level Dictionary object?
How can I have my Web visitors upload a file from their computer to the Web server without using a component?
How can I show a table of records from a recordset and let my users choose which field (column) to sort on?
How can I execute ASP pages on Windows 9X? (How do I install Personal Web Server?)
I've got ASP installed on my computer. What version of ASP am I using, though?
How can I perform advanced networking functions through an ASP page, such as SNMP, FTP, WhoIs lookups, etc.?
Why do I get an error when I try to insert a value into a database that contains an apostrophe?
I'm getting an error (80020009) when trying to work with a value from a Memo (or text or blob) column. For example, I get this error when I do: Response.Write objRS(MemoColumnName)
Why does the .RecordCount property return a value of -1?
How can I effectively use a checkbox to update data in a database? (A typical example might be changing the status of members in a roster from active to inactive or vice versa.)
How can I create a file with a random file name?
How is an array stored in memory? I am interested in learning about the internals of an array!
How is a two-dimensional laid out in memory?
I want to repeat a character or string X number of times, is there a way I can do this without expensive looping operations?
How can I create a text file on the Web server's file system?
How can I remove multiple spaces between words in a string? That is, if I have: Hi    there how can I get: Hi there?
How do I set a string variable so that it has quotes in it? I want a variable to equal: Bob said, "Hello."
How can I determine the number of days in a given month?
How do I convert an all uppercase or all lowercase string into mixed case (first letter of each word uppercase, all other letters lower case)?
How do I put an array into a Session or Application "variable"? How do I then use it on the next ASP page?
How can I count the number of substrings in a string?
How can I use application-level variables to cache information?
What databases can ASP work with? How do technologies like ADO, OLE-DB, and ODBC fit in?
How can I count the total number of words that appear in a string?
What are some issues that may arise when using dates and working with databases?
How can I take the result of a SELECT...MULTIPLE or a group of same-named checkboxes and turn it into a query? That is, if the user selects 3 answers, how can I construct a query that looks for all 3?
I have a database with a table of categories and a table of subcategories. How can I easily make a display that will show each category with its related subcategories grouped under it?
How can I strip the HTML tags from a text string using regular expressions?
What third-party file uploading components are available?
What is ASP.NET?
What do I need to start working with ASP.NET?
Where can I learn more about ASP.NET?
Why do I get the error "The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another" when I try to open a recordset?
How can I convert a Recordset into an array? Also, how can I convert an array into a Recordset?
What are the differences between ASP.NET Beta 1 and Beta 2?
How do I convert a string into an Integer?
How can I print a web page in ASP?/Can I bypass the printer dialog box?
How can I rename a directory on my Web server?
How can I secure an Access database that I use on my Web site? That is, I don't want users to be able to guess the URL of my Access .mdb file and download my database!
Fundamentals of client-server ASP:   How can my ASP code call a JavaScript (or VBScript) function in the browser? How can I use a function or event in the browser to call a VBScript function in ASP?
How do I post in a message board (and get answers)?
How can I get all Field Names or Column Names from a recordset or database table ? ..or.. How can I write a general "table dump" for all records and fields in a recordset or table?
How can I display images that reside in my database through an ASP page?
How can I pick a random record from a table, using a stored procedure?
Why do I get a closed recordset from my stored procedure? Why don't I get the expected fields from the stored procedure?
Is ASP.NET output compatible with all browsers? If not, what browsers is the output compatible with?
How can I delete files by extension in a given directory? What if I have multiple file extension names I want to delete?
How much will ASP.NET (the .NET Framework) cost once Microsoft is finished with Beta testing and ready to roll a "final" version?
How can I output the records from my recordset in columns in a table? That is, instead of just one record per row in a table, how can I have multiple records per row?
How can I determine the location of user by their IP, or validate the identity of a user based on his IP?
How can I install Personal Web Server (PWS) onto Windows XP Home edition?
How can I format numbers and date/times using ASP.NET? For example, I want to format a number as a currency.
What are the differences between ASP.NET Beta 2 and Version 1.0?
How can I calculate the years, months, and days between two dates?
How can I randomly select n lines from a text file?
What are the differences between C# and VB.NET, and which language should I use to create my ASP.NET Web pages?
I have many duplicate records in my database table. I want to delete all of them except one. How can I do this?
If I deploy an ASP.NET Web application will the sysadmin of the Web server where the code in installed be able to see my ASP.NET Web page source code?
How do I use regular expressions from an ASP.NET Web page?
How are dates and times stored in the various components of ASP? Why does the appearance of a date and/or time change depending on what I use to display it?
How do I display data on a web page using arrays instead of Do...While...MoveNext...???...
How do I make my forms show what the user chose before? That is, how do I show which OPTION the user previouly selected? Which checkbox? Which radio button?
When using the FSO, my ASP page tends to "hang", but doesn't report any errors.
How can I restrict access to a page or a portion of my Web site?
What is the SQL Injection Attack? Am I at risk? How do I fix such a security hole?
Can I store VBScript class objects in a Session variable?
How can I share cookies between my server-side scripts (ASP) and my client-side scripts (e.g., JavaScript in the browswer)?
What is the Cross Site Scripting security vulnerability? Am I at risk? How do I plug this security hole?
What is XML?
How can I convert database data into XML (in both ASP and ASP.NET)?
What is the easiest way of extracting certain data from an XML document?
What are some of the more advanced regular expression features available with .NET?
I have installed the .NET Framework, but my Web server won't serve ASP.NET Web pages. Help!
What is XSLT and how does it relate to XML?
How can I display XSL-formatted XML data in an ASP.NET Web page?
Why do I get an error message, "Access to the path is denied?"
How do I delete a file from the Web server's file system?
How do I copy or move a file from one location to another?
How do I rename a file or directory?
How do I determine if a file or directory exists?
How can I read the entire contents of a text file into a string?
How can I read the contents of a text file one line at a time?
How can I create an XML document from an ASP.NET Web page?
In ASP.NET, how can I create an XmlDocument instance from an XML string? Similarly, given an XML string, how can I display the data in a data Web control?
How do I send the information a user enters into a form as an email message?)(*&^


A listing of FAQs that contain the word "Determine":
How can I determine if a visitor has cookies support enabled in his/her browser?
How can I determine the length of a string (how many characters are in a string)?
How can I determine the position of a particular string in an Array?
How can I determine the file size of a file on the Web server?
Using VBScript, how can I determine if a variable is a valid date or not?
How can I quickly determine if a string exists within an array?
How can I determine the upper or lower bounds of an array?
How can I determine the number of days in a given month?
How can I determine the location of user by their IP, or validate the identity of a user based on his IP?
How do I determine if a file or directory exists?


View the Source Code:
 <%
  Dim objConn
  Set objConn = Server.CreateObject("ADODB.Connection")
  objConn.Open "DSN=Foo"
  
  Dim objRS
  Set objRS = Server.CreateObject("ADODB.Recordset")

  objRS.Open "SELECT FAQID, Description FROM tblFAQ", objConn

  Dim aTable
  aTable = objRS.GetRows()

  objRS.Close
  Set objRS = Nothing

  objConn.Close
  Set objConn = Nothing


  'Now, create an array based on a single column in aTable
  Dim aSymbols
  aSymbols = CreateArrayFromColumn(aTable, 1)

  'Display each element in aSymbols
  Response.Write join(aSymbols, "<BR>")

  Response.Write "<p><hr><p><b>A listing " & _
      "of FAQs that contain the word ""Determine"":</b><br>"

  Dim aFilteredSymbols
  aFilteredSymbols = Filter(aSymbols, "determine", True, vbTextCompare)
  Response.Write join(aFilteredSymbols, "<BR>")
  

  Function CreateArrayFromColumn(aSlurp, iCol)
    'Returns a one dimensional array based on the column iCol
    'in aSlurp, a 2d array

    Dim iLoop, strResult
    For iLoop = LBound(aSlurp, 2) to UBound(aSlurp, 2)
      strResult = strResult & aSlurp(iCol, iLoop) & ")(*&^%"
    Next

    'Hack off the last comma
    strResult = Left(strResult, Len(strResult) - 1)

    'Now, return an array
    CreateArrayFromColumn = split(strResult, ")(*&^%")
  End Function
%>


[Return to the Article]