using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;

public partial class Ex4_2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
  
    }
    protected void btnconn_Click(object sender, EventArgs e)
    {
      string strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("mdata.mdb") + ";Jet OLEDB:DataBase Password="+txtmm.Text+";User id=admin";
      OleDbConnection conn = new OleDbConnection(strcon);
      try
      {
        conn.Open();
        lblmes.Text = "连接成功！";
      }
      catch (Exception error)
      {
        lblmes.Text = "连接失败！";
      }
      finally
      {
        conn.Close();
      }  
    }
}
