asp.net至少一个参数没有被指定值

来源:百度知道 编辑:UC知道 时间:2024/05/21 15:09:00
private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
string temp=Request.QueryString["BookID"];
this.ddltobind();
OleDbConnection con=DBCON.createcon();
con.Open();
OleDbCommand cmd=new OleDbCommand("select * from Book where BookID="+temp,con);
OleDbDataReader odr=cmd.ExecuteReader();
if(odr.Read())
{
this.txt_title.Text=odr.GetString(1).ToString();
this.txt_author.Text=odr.GetString(2).ToString();
this.txt_date.Text=odr.GetDateTime(3).ToLongDateString();
this.txt_content.Text=odr.GetString(6).ToString();
this.lbl_class.Text=odr.GetString(5).ToString();
}
odr.Close();
con.Close();

}
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//

OleDbCommand cmd=new OleDbCommand("select * from Book where BookID="+temp,con);

你看看是不是这句有点问题呀。。。。
是不是应该这样写才对("select * from Book where BookID='"+temp+"'",con)
我估计就是这句话错了。。
你再试试吧。。。。