<% @ Page language = "c #"%>
<% @ Import namespace = "system.data"%>
<% @ import namespace = "system.data.sqlclient"%>
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.
";
ObjConnection.Close ();
CON_CLOSE.TEXT = "Connection Closed.
";
}
Catch (Exception E)
{
Con_open.text = "Connection Failed to open.
";
CON_CLOSE.TEXT = E.toTOString ();
}
}
script>
hEAD>
Testing The Data Connection asp: label>
h4>
asp: label>
asp: label>
body>
html>