New! other ASP resources

Getting Started with database programming in HTML

In this example, I'm going to assume that you'll be using Visual Interdev and Microsoft ADO because that's what we have in 232 and what we have support for. If you're doing this on some other platform, you're on your own. Please keep in mind that at the moment this must be done in 232; due to the way Internet Explorer was installed, they don't work in 231 or 329. As well, be aware that it will probably not be able to be viewed correctly in Netscape.

There are a lot of permissions that need to be set, so if you get some weird error especially of the type "Permission denied" or "Connection Error 800a0bb9" and you can't figure it out in 17 minutes, send me mail with a full description of what happened and we'll see what's going on.

But enough of the caveats.

Adding an ODBC connection to the machine you're working on

In order to talk to the database, you'll need to put an ODBC connection on the machine that you're working on. To do this, do Start-> Settings -> Control Panel, then choose "ODBC Data Sources". You'll want to add a "System DSN". User DSN means that only you will be able to access this data source, and System DSN means that anyone who is on the machine should be able to access the data source (though only if they provide the necessary NT credentials). A User DSN (which seems like it would be what you want) won't work, so make sure that you choose a System DSN.

So choose System DSN and click on "Add"

At this point, it'll ask you for which driver you want to use. Since you'll be connecting to your project database, you'll want to choose SQL Server. So select "SQL Server", and click finish (no, of course that doesn't mean that you're done). Next you'll want to specify which database you want to talk to. You'll see a dialogue box with three boxes for you to fill in. Pretending that I'm a member of the group "entities", I'd fill them in appropriately:

Click next and choose that you want to connect with SQL Server authentication as given to you by the administrator. This is very important, because otherwise you'll be the only ones able to access the database.
Click next and choose that you want to connect with Windows NT. We'll be sending you mail with your username and password. Each group will have one username and password per database. Note that it's important to create this entry with exactly the same database name, login id and password that we gave you, otherwise when you try to connect on the server, it will not work.
Now click "Next" again, and it'll contact the database to makesure that you have the appropriate permissions. Make sure that you have your group's database selected as the default database (it shouldn't be a problem for you, because you have permissions for one database on ISQL01, so it should figure that out automatically, but check it just in case).

Click next again, then finish, and finally, click "Test Data Source" to make sure that everything ran properly.

Note that this step should only have to be done once (when you actually create the Interdev project), but if you run into problems, it may need to be done again.

Mapping a network drive

First, you'll need to map a network drive to where your internet project space will be. If you skip this step, you will not be able to create the project in Interdev. You may be able to avoid mapping the directory if you're not the one who has to create the project, but you'll be accessing the files often enough that it will probably be worth your while anyway.

The project spaces are in the share at \\iinetsrv\fall99. So right click on "Network Neighborhood", click on "Map Network Drive", pick some drive that's not currently occupied, and then for the path type in "\\iinetsrv\fall99". Make sure that you've checked yes for reconnect at login, or you'll have to reconnect it the next time that you log in.

Getting started with Interdev

First, start up Visual Interdev using the start, programs, where ever Visual Interdev is; either at that level, under Visual Studio 6.0, or somewhere more cryptic.

The project only needs to be created once. To create the project, choose "New project", and when it prompts you for what type of project you want to make, select "Visual Interdev Projects" in the left panel and "New Web Project" in the right panel.

For the directory in which to create the project, let's assume that you've mapped \\iinetsrv\fall99 to the I drive. Your project space wil be at i:\cse444\[iinetsrv space name]. You can find your group's iinetsrv space name at the project groups page. So, for example, if you were on the Galaga99 team, your iinetsrv space name would be cse444aa.
Now click next.

It will ask you what server you want to use, and you want (surprise) iinetsrv. At the bottom it'll ask you if you want master mode or local mode. Ideally, we'd want local mode, but since that seems to be broken at the moment, don't use it. Choose master mode, and click next.

Next it will ask you what theme you want to use. Since none of the themes were loaded when Interdev was installed, don't bother. Click finish, and in mere moments (well, some number of moments that really takes far too long), it'll come back with a new project (we hope, we hope).

At this point you've gotten the project set up so that now it knows what web server it's running on. Now you need to get web server to know to look for the database by

Adding a data connection

Under project explorer, there will be a line with "iinetsrv/[your project name here]", which represents the root of your project. Right click on it and choose "Add Data Connection"

Next a window entitled " Data Link Properties" will come up. You want to choose "Microsoft OLE DB Provider for ODBC Drivers" Don't mess with the other stuff until you have at least one connection working, okay? Click "Ok"

A window will ask you what DSN you want to use; choose the one you created above (under System DSN, remember?). Click Ok, and it'll prompt you for a login and password. Provide them, and click okay again.

A new window will pop up asking you what properties you want. All of the general and Miscellaneous properties should be fine. Click on "Authentication" and make sure that the passwords are there (there should be little x's) and then make sure that both "Save Design-time Authentication" and "Save Run-time Authentication" are checked. This will save you from having to fill in the password each time you re open Interdev.
Click on Ok.

Congrats! You're almost there! Now add a new ASP page to check to see if it worked:

Next, add a Recordset by clicking on the Toolbox tab in the lower left, then choosing "Design Time Controls" and then dragging a recordset into the ASP page (between the beginning and ending of the body). A recordset is how ASP pages get their data.... if you play with the properties, you'll see that you can either take a whole table or the results of a sql statement. For the moment, just pick a table.

Next, add a Grid (drag it over from the Design Time Controls menu again) below the recordset. Right click on the grid and choose properties. Under the Data tab, you should see choices for which recordset to use (use the one created above), and then once you've selected that, to the right you'll see attributes that you can use. Select some, and click okay. (this is just to test and make sure that all of the connections worked; it doesn't matter what it is). Now, right click on the ASP page, choose view in browser, say okay to anything that it asks, and hopefully, you'll see a page with data!

That's all, folks

From there on in, you're on your own. Enjoy your hacking!