主题:连接access数据库出现问题...
[b]代码如下:[/b]
try
{
OleDbConnection con = new OleDbConnection ();
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" +
Server.MapPath("DB.mdb");
con.Open();
string sql_str = "select * from Guest ORDER BY time DESC";
OleDbCommand cmd = new OleDbCommand(sql_str,con);
OleDbDataAdapter odda = new OleDbDataAdapter();
odda.SelectCommand = cmd;
DataSet ds = new DataSet();
odda.Fill(ds,"Guest");
this.DataGrid1.DataSource = ds.Tables["scores"].DefaultView;
this.DataGrid1.DataBind();
}
catch (Exception excp)
{
Response.Write(excp.Message);
}
[b]
异常:[/b]
找不到可安装的 ISAM。
我左改又改还是这种情况我郁闷,哪位指点一下撒~感激不尽。。。
try
{
OleDbConnection con = new OleDbConnection ();
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" +
Server.MapPath("DB.mdb");
con.Open();
string sql_str = "select * from Guest ORDER BY time DESC";
OleDbCommand cmd = new OleDbCommand(sql_str,con);
OleDbDataAdapter odda = new OleDbDataAdapter();
odda.SelectCommand = cmd;
DataSet ds = new DataSet();
odda.Fill(ds,"Guest");
this.DataGrid1.DataSource = ds.Tables["scores"].DefaultView;
this.DataGrid1.DataBind();
}
catch (Exception excp)
{
Response.Write(excp.Message);
}
[b]
异常:[/b]
找不到可安装的 ISAM。
我左改又改还是这种情况我郁闷,哪位指点一下撒~感激不尽。。。