<%@ Page Language="c#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
void Page_Load()
{
string strConnection = "user id=netboyc;password=wd111l;";
strConnection += "initial catalog=aspx;data source=localhost1;";
strConnection += "Connect Timeout=30";
data_src.Text = strConnection;
SqlConnection objConnection = new SqlConnection(strConnection);
try
{
objConnection.Open();
con_open.Text="Connection opened successfully.<br />";
objConnection.Close();
con_close.Text="Connection closed.<br />";
}
catch (Exception e)
{
con_open.Text="Connection failed to open.<br />";
con_close.Text=e.ToString();
}
}
</script>
<html>
<head>
</head>
<body>
<h4>Testing the data connection <asp:Label id="data_src" runat="server"></asp:Label>
</h4>
<asp:Label id="con_open" runat="server"></asp:Label>
<br />
<asp:Label id="con_close" runat="server"></asp:Label>
<br />
</body>
</html>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
void Page_Load()
{
string strConnection = "user id=netboyc;password=wd111l;";
strConnection += "initial catalog=aspx;data source=localhost1;";
strConnection += "Connect Timeout=30";
data_src.Text = strConnection;
SqlConnection objConnection = new SqlConnection(strConnection);
try
{
objConnection.Open();
con_open.Text="Connection opened successfully.<br />";
objConnection.Close();
con_close.Text="Connection closed.<br />";
}
catch (Exception e)
{
con_open.Text="Connection failed to open.<br />";
con_close.Text=e.ToString();
}
}
</script>
<html>
<head>
</head>
<body>
<h4>Testing the data connection <asp:Label id="data_src" runat="server"></asp:Label>
</h4>
<asp:Label id="con_open" runat="server"></asp:Label>
<br />
<asp:Label id="con_close" runat="server"></asp:Label>
<br />
</body>
</html>