Created
September 26, 2014 17:38
-
-
Save russau/d74278dfb9d76f12cf6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" %> | |
<%@ Import Namespace="System.Data.SqlClient" %> | |
<% | |
System.Net.IPHostEntry host; | |
string hostname = "rsmazdb.copiliunddin.us-west-2.rds.amazonaws.com"; | |
host = System.Net.Dns.GetHostEntry(hostname); | |
foreach (System.Net.IPAddress ip in host.AddressList) | |
{ | |
Response.Write(String.Format("<p>{0} -> {1} | ",hostname, ip)); | |
} | |
using (SqlConnection conn = new SqlConnection("Data Source=rsmazdb.copiliunddin.us-west-2.rds.amazonaws.com;"+ | |
"Initial Catalog=demo;" + | |
"Integrated Security=False;" + | |
"User ID=rsmaz_user;" + | |
"Password=[redacted]")) | |
{ | |
SqlCommand cmd = new SqlCommand("SELECT COUNT(1) FROM Country", conn); | |
try | |
{ | |
conn.Open(); | |
int c = (Int32)cmd.ExecuteScalar(); | |
Response.Write("SELECT COUNT(1) FROM Country -> " + c + "</p>"); | |
} | |
catch (Exception ex) | |
{ | |
Response.Write(ex.Message); | |
} | |
} | |
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" %> | |
<%@ Import Namespace="System.Data.SqlClient" %> | |
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<meta charset="utf-8" /> | |
<title></title> | |
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js"></script> | |
<script> | |
$(function () { | |
$.ajaxSetup({ | |
// Disable caching of AJAX responses | |
cache: false | |
}); | |
var i = 0; | |
setInterval(function () { | |
$('<div></div>').css("background-color", (i++ % 2) == 0 ? "#c9c9c9" : "#ffffff").load("ajax.aspx").appendTo('#ping'); | |
// http://stackoverflow.com/questions/1948152/select-last-5-elements-with-jquery | |
var pings = $('#ping > div').length; | |
if (pings > 50) | |
$('#ping > div').first().remove(); | |
}, 2000); | |
}) | |
</script> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div id="ping"></div> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment