OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("/wunjuonline/database/wunjuDB.mdb"));
con.Open();
OleDbCommand cmd=new OleDbCommand("select * from productTable where proudctID='9'",con);
OleDbDataReader odr=cmd.ExecuteReader();//就这一句报错。
odr.Read();错误提示:
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。
con.Open();
OleDbCommand cmd=new OleDbCommand("select * from productTable where proudctID='9'",con);
OleDbDataReader odr=cmd.ExecuteReader();//就这一句报错。
odr.Read();错误提示:
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。
解决方案 »
- 非常棘手的一个treeview绑定问题,望高手指教!
- 在Gridview添加了一个删除按钮后,如果我想点击按钮后,能得知这行的行号,应该如何去做,麻烦详细一点.
- ADO.NET工厂模式下数据删除错误
- 请问:vs2005里使用存储过程给表添加记录,我是菜鸟,方法要简单哦
- 发布一个用 asp.net2.0写的类似csdn的论坛源代码
- 怎样将一个建好的ASP.NET工程移植到本地机器??? 急~!!!
- 请Asp.net高手进来,解决了马上给分???????????
- 关于datagrid中的dropdownlist的问题:
- 我刚进入图书业,在国内有作者群,国外有版权交易渠道,请教大家一些问题?给分:)
- 有关<Form action=""><input type="submit"><asp:button Onclick="">关注一下吧!多谢!
- SQL与asp.net连接, 运行后出现"创建锁错误",WEB什么也不显示!
- 一个aspx页面里面用了两个button 还用了一些验证控件 我想点其中一个button ,其中一些验证控件不起作用
要這樣寫:
OleDbDataReader odr;
odr=cmd.ExecuteReader();
--->改为
OleDbDataReader odr=cmd.ExecuteReader(CommandBehavior.CloseConnection);
说明:这是一个用户控件
//控件属性
private string pID="";
public string productID
{
set
{
this.pID=value;
}
}
//page_load()事件中代码,
{
OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("/wunjuonline/database/wunjuDB.mdb"));
con.Open();
OleDbCommand cmd=new OleDbCommand("select * from productTable where proudctID='"+pID+"'",con);
OleDbDataReader odr=cmd.ExecuteReader();//这一句错,错误提示如题
odr.Read();
this.lblNo.Text=odr.GetString(0).ToString();
this.lblName.Text=odr.GetString(2).ToString();
this.lblPrice.Text=odr.GetString(3).ToString();
this.photo.ImageUrl="/wunjuonline/images/"+odr.GetString(4);
this.txtQty.Text="0";
this.hlkOrder.NavigateUrl="/wunjuonline/order.aspx?id="+lblNo.Text;
}我是在一个页面中加载这个用户控件时出错的,经跟踪测试,属性值也正确传进来了,
跟踪 cmd.CommandText的值,也正确(sql语句为:select * from productTable where typeID='2b1')
我搞不懂那句为何执行时报错
当我调试时,把cmd那项不加任何where条件时,也是同样的错误各位帮手呀,,,分不够另开贴加NND,折腾死了。。
//这部分就通过了
OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("/wunjuonline/database/wunjuDB.mdb"));
con.Open();
OleDbCommand cmd=new OleDbCommand("select * from productTable where productID='"+pID+"'",con);
OleDbDataReader odr=cmd.ExecuteReader();
odr.Read();//这部分就是见鬼的代码,不通过。
OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("/wunjuonline/database/wunjuDB.mdb"));
con.Open();
OleDbCommand cmd=new OleDbCommand("select * from productTable where proudctID='"+pID+"'",con);
OleDbDataReader odr=cmd.ExecuteReader();//这一句错,错误提示如题
odr.Read();两部分完全一样嘛,,怪事。瞅瞅,大家分享一下。