服务器报错:异常详细信息: System.InvalidOperationException: ExecuteReader 要求已打开且可用的连接。连接的当前状态为已关闭。
OleDbConnection Conn;
String Provider,DataBase,ConnStr;
Provider = "Microsoft.Jet.OLEDB.4.0;";
DataBase = Server.MapPath("Icccbe.mdb");
ConnStr = "Provider="+Provider+"Data Source="+DataBase;
Conn = new OleDbConnection(ConnStr);
// String No="select MAX(ID) from paper";
//String No="Select MAX(ID) From papers";
//int a=No[0];
//int a=LastIndexOf("NO");
//String sdr="Select ID From papers Order by ID DESC";
OleDbCommand cmdSelectIP;
OleDbDataReader dtrIP;
cmdSelectIP=new OleDbCommand("Select * From papers Order by ID DESC", Conn);
dtrIP=cmdSelectIP.ExecuteReader();
dtrIP.Read();
int TheCounter=Convert.ToInt32(dtrIP["ID"]);
Response.Write(TheCounter);
dtrIP.Close();
棒棒看看我的程序错在哪?