A Review of ASP-db - a product by USIntertech, Inc.
September 20, 2000
Databases are typically a challenge to develop. With ASP, you get to play with the new approaches - Advanced Data Objects (ADO), VBScript and the other native features of developing with ASP really make ASP and the scripting languages the tools of the trade when you're developing web-based solutions.
If you've been around the PC industry, or any portion of the computer industry for that matter, and you've been working as a programmer, you may have come to realize that programming and User Interface creation are NOT the same. Programming is an art, UI creation is an art. Typically people have one, but not both desires when the develop applications. In fact, there are many times when a programmer has no business at all writing the code that will drive the UI!
But when you develop applications, the client doesn't say - "I don't care if it's incredibly ugly, just make it technologically outstanding!" Too bad. :)
Instead, you get a requirement to mix your skills at developing that really cool snippet of code with formatting querying the database, and more.
That's where the promise of ASP-db comes in. ASP-db is a database access and output formatting object that you can register on the server and then call from your ASP code. It takes the building of tables for output, forms for editing and navigation approaches completely out of the equation. ASP-db promises to take away the details of making the connection to the database, querying the database with your SQL statement (dynamic or otherwise) and showing the results, formatted as you wish.
So, that means that code like the following:
mySWYNK.Open Session("SWYNK_ConnectionString"),Session("SWYNK_RuntimeUserName"), Session("SWYNK_RuntimePassword") Set mycmdTemp = Server.CreateObject("ADODB.Command") Set myRSPartners = Server.CreateObject("ADODB.Recordset") mycmdTemp.CommandText = strSQL mycmdTemp.CommandType = 1 Set mycmdTemp.ActiveConnection = mySWYNK myRSPartners.Open mycmdTemp, , 1, 3
goes away. In addition, all that table code you've been dreading won't have to be written anymore, right? Here's what we did to put ASP-db to the test.
Designing the Forums and Building the Default Page
Our code would connect to the database, build the query string, parse the rows, build the table code on the fly, etc. We replaced that code with the following (I've removed color setting and what-not so you can see what it really takes):
Set MyDb = Server.CreateObject("AspDB.Pro") MyDb.dbDSN="dsn=blah;uid=blah;pwd=blah;database=blah" MyDb.dbImageDir="/aspdb/images/" MyDb.dbSQL = sqlquery MyDb.dbBoolText="<center><img src=""/images/checkbox.gif""></center>," 'Show centered checkbox.gif if TRUE else blank MyDb.dbNavigation="both" 'Show nav bars at top and the bottom MyDb.dbNavigationIcon="std" 'Use the std "blue" navigation icon GIF files mydb.dbGridInc=50 'Show 50 records at a time 'Use dbMagicCell to "remap" the fields to have hot-links to the getmessage program & pass the contents of the ID field. MyDb.dbMagicCell="replies,,<a href=""getmessage.asp?rootid=#id#&id=#id#"">Replies</a>;" & _ "subject,,<a href=""getmessage.asp?rootid=#id#&id=#id#"">#subject#</a>;" & _ "msgfrom,,<a href=""mailto:#email#"">#msgfrom#</a>;" MyDb.dbEditflds = "subject,msgfrom,msgdate,email,body" 'Choose which fields to show on EDIT screen MyDb.dbNameMap = "msgFrom,Posted By;msgDate,Date;lastupdate,Last Upd;Replies,Replies?" MyDb.aspDBPro
One important note: most of this is custom formatting you really only need to give it the sql statement, give it the connection info and GO.
There are several neat things happening here. First, you'll notice that the properties are easy to understand and you can pretty much follow through this to see what's happening. The sql statement is placed into sqlquery and the balance is just telling ASP-db what you need it to do. The administrative mode just takes a command-line parameter and turns on the download and editing forms. As messages are edited, triggers on the SQL 7 server update referring rows automatically.
There are some REALLY cool things that ASP-db does for you - check out the dbMagicCell - you can format a field to do literally ANYTHING HTML-wise, and you can remap values, change look and feel, etc. In our case, we use dbMagicCell to help with the customized URL that calls up messages to be read. In addition, it adds the HREF parameters to the other fields, making them clickable on the display.
dbMagicCell made ASP-db fun - we played with all sorts of things - formatting and otherwise with this feature - it was outstanding! I've personally not seen anything so versatile in building ASP pages and database connections.
We also used the dbBoolText property to show the little check marks, indicating that replies had been received for a given thread. This was great too, and worked flawlessly. It shows the checkmark (or not) based on the value of the column, automatically. No IF... statement, no CASE statements. It just works.
It's available as a demonstration (row-limited) download from their web site. If you build database-enabled web sites with ASP, I strongly urge you to download it and give it a spin. I don't think you'll be sorry.