This page demonstrates the capabilities how to display a table from a SQL statement. It illustrates not only how to display the table, but also how to detect that no records
were returned from a query, and how to detect null and blank values in the data.
You all must have seen and done stuff with the RecordSet object, infact everything is done with the RecordSet object. Now, this acticle explains how to use GetRows to page through the records that you recieve from the SELECT. It's much faster than MoveNext, because it closes the database connection immediately whereas MoveNext loops through the records with the overhead of the database connection. Plus GetRows let's you count the records correctly!
Have this short program around so that you can quickly see what columns and what data are in your database. Here you will see some of the common methods and properties used to limit the results from your SQL query. Using a simple form that takes a table name and a submit button, and you can easily display increments of the table data. Full source code available.
This hands-on tutorial explains how to develop a simple SQL-driven web site in just minutes. Topics include: Our Database Design, Creating a Data Source, Inserting A Tip Into Our Database, Displaying and Deleting Tips, Searching the Database, and Displaying the Tips.
This article shows how to generate random records from the database. Also explains how to generate random numbers. Sample Database and Code available for download.
This is an article on executing all or none database queries using ASP-Database transactions. Must read for ASP-Database developers. Sample Database and Code available for download.
This is an article on using Recordset. It uses GetRows method to speedup database access. One of the fastest ways of displaying database records with ASP. Sample Database and Code available for download.
This is a brief and very useful tutorial on creating and using stored procedures with your asp applications. A stored procedure is nothing more than an sql statement stored inside a database. The database can be SQL Server or MS Access as well as others. A stored procedure is compiled by your database (for the most part) one time, when it is entered. This results in faster database executions and overall performance updates, and it further separates the sql statement from your asp leaving you with more readable code. This tutorial describes: What is a stored procedure?, Writing stored procedures, Getting the stored procedure into the database, Calling stored procedures in ASP pages, and Modifying and removing stored procedures.
Want to add value to your current search? Allow your users to search from within search results. As databases grow the necessity for the user to continually narrow a search to the item that they truly want will grow also. The following example utilizes a db on U.S. State capitals. Upon the first search two radio buttons will appear indicating a search (default) or a search within the current results. Searching within the current results will take the first search and add it to the new search and so on.
Allowing multiple choices of data elements enables people to customize views of your data and adds value to your applications. In this sample code, user inputted choice(s) are added to the basic sql statement to draw them from the db. Since the input from the dropdown menu comes through comma delimited it is simply written into the statement without modification. Two simple for next loops determine which elements are part of the record set and displays them accordingly.