高分请说下,各位帮忙看一下,我这程序哪里出了错误??
行句柄无效。说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OleDb.OleDbException: 行句柄无效。
源错误:
行 48: //显示数据
行 49: myReader.Read();
行 50: password.Text = myReader.IsDBNull(1)?"":myReader.GetString(1);
行 51: stuname.Text = myReader.IsDBNull(2)?"":myReader.GetString(2);
行 52: stuno.Text = myReader.IsDBNull(3)?"":myReader.GetString(3);
源文件: e:\勤助中心\webapplication1\mimaxiugai.aspx.cs 行: 50
堆栈跟踪:
[OleDbException (0x80040e04): 行句柄无效。]
System.Data.OleDb.OleDbDataReader.ProcessResults(Int32 hr)
System.Data.OleDb.OleDbDataReader.GetRowDataFromHandle()
System.Data.OleDb.OleDbDataReader.FindValueBinding(Int32 index)
System.Data.OleDb.OleDbDataReader.PeekValueBinding(Int32 index)
System.Data.OleDb.OleDbDataReader.IsDBNull(Int32 ordinal)
WebApplication1.WebForm2.Page_Load(Object sender, EventArgs e) in e:\勤助中心\webapplication1\mimaxiugai.aspx.cs:50
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
private void Page_Load(object sender, System.EventArgs e)
{ string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=e:\db2.mdb";
string strSql;
OleDbConnection myConn;
OleDbCommand myComm;
myConn=new OleDbConnection(strConnection);
strSql="select Stuid,Stuname,password from student where Stuno='"+stuno+"' or Stuname='"+stuname+"'";
myComm=new OleDbCommand(strSql,myConn);
myConn.Open();
OleDbDataReader myReader;
myReader = myComm.ExecuteReader();
myReader.Read();
password.Text = myReader.IsDBNull(1)?"":myReader.GetString(1);
stuname.Text = myReader.IsDBNull(2)?"":myReader.GetString(2);
stuno.Text = myReader.IsDBNull(3)?"":myReader.GetString(3);
myReader.Close();
myConn.Close();