view plaincopy to clipboardprint?
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
using MySql.Data.MySqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string myConnectionString = "Database=test;Data Source=localhost;User Id=root;Password=admin";
MySqlConnection mycn = new MySqlConnection(myConnectionString);
try
{
mycn.Open();
Response.Write("<mce:script type="text/javascript"><!--
alert('连接成功')
// --></mce:script>");
}
catch (Exception ex)
{
Response.Write("<mce:script type="text/javascript"><!--
alert(" ex.ToString() ")
// --></mce:script>");
}
}
}