Jordon, what kind of database? Hopefully SQL.
Anyways, check over this link, I didn't look to closely but it probably has some hints for you... and it isn't done with a code behind page either, but it works and you can easily implement a code behind page.
http://msdn.microsoft.com/library/de...qldatabase.asp
edit: Just out of curiousity, I'm assuming you're doing this in .NET, what language are you using for the code behind? VB? C#?