i have a database on a remote server.

i want to run a query on that server and retrieve some info from a C++ exe program that runs from a hyperlink.

also, before making that connection, i want the program to check if the user is logged on or authenticate the user before making that access.

with the info retrived, i want to generate a dynamic web page that will pop up for the user to see.

can someone please point me to the right resources to do all this? what libraries, functions to use etc?