First, this is a matter of how a web server accesses a database server so that it isn't like a form was submitted to a different server. There are objects in ADO to handle executing commands and recordsets as you do NOT post directly into SQL unless you enjoy security bugs as what if for a search query someone knowingly enters some text to end that command and do something malicious on the database.

ASP101 Link which contains examples of connection strings that allow one to specify a data source. Sometimes you'll have a DSN on one machine to point to another while in other cases you may want to code the server name in the connection string, either way can work.