这个是什么错误?
“/loupan”应用程序中的服务器错误。
--------------------------------------------------------------------------------至少一个参数没有被指定值。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[OleDbException (0x80040e10): 至少一个参数没有被指定值。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleRow(tagDBPARAMS dbParams, Object& executeResult) +206
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +107
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +69
loupan.chaxun.Page_Load(Object sender, EventArgs e) +1119
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
代码如下: StartIndex = 0;//StartIndex是int类型的公用变量
// string name;
// name=Server.MapPath("lpan.mdb");
myConnection2 = new OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + dbname );
myConnection2.Open();
myCommand2 = new OleDbCommand( "SELECT mycount = COUNT(*) FROM lpan", myConnection2 );
// myConnection2.Open();
// OleDbDataReader dr = myCommand2.ExecuteReader(CommandBehavior.SingleRow);
OleDbDataReader dr = myCommand2.ExecuteReader(CommandBehavior.SingleRow);
if (dr.Read())
DataGrid1.VirtualItemCount = (int)dr["mycount"];
dr.Close();
myConnection2.Close();
SetGridSource(StartIndex, "上一页");
“/loupan”应用程序中的服务器错误。
--------------------------------------------------------------------------------至少一个参数没有被指定值。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[OleDbException (0x80040e10): 至少一个参数没有被指定值。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleRow(tagDBPARAMS dbParams, Object& executeResult) +206
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +107
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +69
loupan.chaxun.Page_Load(Object sender, EventArgs e) +1119
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
代码如下: StartIndex = 0;//StartIndex是int类型的公用变量
// string name;
// name=Server.MapPath("lpan.mdb");
myConnection2 = new OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + dbname );
myConnection2.Open();
myCommand2 = new OleDbCommand( "SELECT mycount = COUNT(*) FROM lpan", myConnection2 );
// myConnection2.Open();
// OleDbDataReader dr = myCommand2.ExecuteReader(CommandBehavior.SingleRow);
OleDbDataReader dr = myCommand2.ExecuteReader(CommandBehavior.SingleRow);
if (dr.Read())
DataGrid1.VirtualItemCount = (int)dr["mycount"];
dr.Close();
myConnection2.Close();
SetGridSource(StartIndex, "上一页");
myConnection2 = new OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + dbname );
myConnection2.Open();
myCommand2 = new OleDbCommand( "SELECT mycount = COUNT(*) FROM lpan", myConnection2 );
OleDbDataReader dr = myCommand2.ExecuteReader(CommandBehavior.SingleRow);
if (dr.Read())
DataGrid1.VirtualItemCount = (int)dr["mycount"];
dr.Close();
myConnection2.Close();
SetGridSource(StartIndex, "上一页");
if (dr.Read())
DataGrid1.VirtualItemCount = (int)dr["mycount"];
dr.Close();
myConnection2.Close();
SetGridSource(StartIndex, "上一页");
这一部分屏蔽一下,看看有没有错误
如果有,那么应该是cmd和conn的问题
然后在把那条sql语句放在access的查询分析器里面执行以下,看看对不对?
去掉mycount
select count(*) from lpan 就可以了
还是一样的错误啊
myConnection2.Open();
OleDbCommand myCommand2 = new OleDbCommand( "SELECT count(*) as mycount FROM lpan", myConnection2 );
OleDbDataReader dr = myCommand2.ExecuteReader();我试过了,可以的
OleDbDataReader dr = myCommand2.ExecuteReader(CommandBehavior.SingleRow);
if (dr.Read())
DataGrid1.VirtualItemCount = (int)dr["mycount"];
dr.Close();
myConnection2.Close();
SetGridSource(StartIndex, "上一页");
你试下看
你这些都是什么东西?我没有办法试
真不知道你到底是哪里出了问题