Viewing source for Recipe1004cs.aspx

<%@ Page Language="C#" %>
<%@ Import Namespace="eInfoDesigns.dbProvider.MySqlClient" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e) 
{
    //get connection string from dropdown list
    String connectString = "Data Source=server;Database=mydb;User ID=user;Password=pass;Command Logging=false";

    MySqlConnection myConn = null;

    //use try/catch because we may fail to connect
    try
    {			
	    myConn = new MySqlConnection( connectString );		
    	myConn.Open();
    		
    	//we connected!
    	lblConnectInfo.Text = "Connection successful!";

	    //do something and then be sure to close the connection...
    }
    catch
    {
    	//was your connection string correct?
    	lblConnectInfo.Text = "Connection failed!";
    }
    finally
    {
    	if (myConn != null)
    		myConn.Close();
    }	    	
}
</script>
<html>
	<head>
		<title>Recipe1004cs</title>
	</head>
	<body>
		<form id="Recipe1004csForm" method="post" runat="server">
			This page simply tries (and fails) to open an MySql connection.
			<asp:Label id="lblConnectInfo" runat="server"></asp:Label>
		</form>
	</body>
</html>