You could import System.Data.SqlClient in your aspx file and start a new connection to the external database. This could either happen in the aspx directly or in the code file in the background. The code below is just a rough example.
...
<%@ Import Namespace="System.Data.SqlClient" %>
...
string connectionString = null;
SqlConnection connection;
SqlCommand command;
string sql = null;
string result = null;
connectionString = @"Data Source=HOSTNAME\INSTANCENAME;" +
@"Initial Catalog=DATABASENAME;User ID=USERNAME;Password=PASSWORD";
sql = @"Your SQL query";
connection = new SqlConnection(connectionString);
try
{
connection.Open();
command = new SqlCommand(sql, connection);
result = command.ExecuteScalar().ToString();
command.Dispose();
connection.Close();
}
catch (Exception ex)
{
result = "No connection to Database";
}
%>
<p>The result is: <%:result%></p>
...