protected static string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
System.Web.HttpContext.Current.Server.MapPath("~/database/db.mdb");///就是你的数据库连接串
///
/// 执行SELECT语句的方法
///
/// 要执行的SELECT语句
///
public static DataSet Execute(string sql)
{
using (OleDbConnection conn = new OleDbConnection(connectionString))
{
try
{
conn.Open();
OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);
DataSet ds = new DataSet();
da.Fill(ds, "aa");
return ds;
}
finally
{
conn.Close();
}
}
}