Building an SQL string from optionally posted criteria is tricky. You need to check if the user posted a value since only then is the criteria included in the query. Numeric entries are different from character entries and multiple-selection fields require additional processing to produce a valid SQL query. Fields that might contain single quotes need special attention to prevent syntax errors.
Displaying an Access or SQL Server database is as easy as entering the variable names and the name of the table into the fields below. Copy the output code into an asp document on your web server and your db is ready to be displayed on the web. The DSN connection requires that you register the DSN for the db prior to executing the code. (Note: G.I.G.O Garbage In Garbage Out applies here, be certain all table elements entered appear in your db. Table elements must be entered in the select field * will not work here.)
This is called a singleton query. ADO.Net has specific functions for singleton queries, but not ADO (ActiveX Data Objects). This article describes how to use an ADO command object to perform faster singleton queries.
Learn how to import the contents of a text file (.txt) when using MS text or OLE DB Drivers wont do! We will be using the FileSystem and TextStream objects for this lesson!
For the purposes of this article we will be using a text file delimited using the "|" symbol. Here is the contents of the text file we will be using - info.txt.
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.