public DataTable GetData(string str_Command)
    {
        try
        {
            OleDbDataAdapter dbAdapter = new OleDbDataAdapter();
            DataSet dbSet = new DataSet();
            DataTable rTable = new DataTable();            db_Command = new OleDbCommand(str_Command,db_Connection);
                   //db_Connection db_Command都是类里面的private变量,访问可以
            dbAdapter.SelectCommand = db_Command;
            //dbAdapter.Fill(dbSet,"getTable"); 
              dbAdapter.Fill(rTable);//这里出现错误 
            //rTable=dbSet.Tables["getTable"];
            return rTable;
        }
        catch
        {
            return null;
        }
    }详细册错误页内容“/web”应用程序中的服务器错误。
--------------------------------------------------------------------------------至少一个参数没有被指定值。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。源错误: 
行 56:             dbAdapter.SelectCommand = db_Command;
行 57:             //dbAdapter.Fill(dbSet,"getTable");
行 58:             dbAdapter.Fill(rTable);
行 59:             //rTable=dbSet.Tables["getTable"];
行 60:             return rTable;
 源文件: c:\Documents and Settings\WindIce\My Documents\web\App_Code\DataLink.cs    行: 58 堆栈跟踪: 
[OleDbException (0x80040e10): 至少一个参数没有被指定值。]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +65
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +181
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +307
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +77
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +188
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +122
   System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +29
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +183
   System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +339
   System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +199
   DataLink.GetData(String str_Command) in c:\Documents and Settings\WindIce\My Documents\web\App_Code\DataLink.cs:58
   _Default.but_Login_Click(Object sender, EventArgs e) in c:\Documents and Settings\WindIce\My Documents\web\Default.aspx.cs:26
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +116
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838 
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.42; ASP.NET 版本:2.0.50727.210 

解决方案 »

  1.   

    不管用Fill的那种参数方式都会有这错误,每办法调试后面的东西了,大虾帮忙~~~~
      

  2.   

    str_Command这个有错吧
    你贴那个语句看看
      

  3.   

    string str_Command = "select [*] from [USER] where (User_Name='" + tb_Name.Text  + "')";
    调试时的值是 "select [*] from [USER] where (User_Name='123')"
    数据库里只有一条 123 123 123的记录
    在Access里可以运行啊
      

  4.   

    db_Connection 会不会这个有问题啊。
      

  5.   

    string   str_Command   =   "select   [*]   from   [USER]   where   (User_Name= ' "   +   tb_Name.Text     +   " ') ";
    改成:
    string   str_Command = "select * from [USER] where ([User_Name]= ' " + tb_Name.Text + " ') ";
    试试
      

  6.   

    恩~~~我想和string值应该没什么关系吧
    错误是"至少一个参数没有被指定值。"
    还有db_Connection 应该是正常的,db_Connection.open()后没有抓到错误,出现上面错误时db_Connection的监视数据如下,基本都是在正确范围里啊db_Connection {System.Data.OleDb.OleDbConnection} System.Data.OleDb.OleDbConnection
    base {System.Data.OleDb.OleDbConnection} System.Data.Common.DbConnection {System.Data.OleDb.OleDbConnection}
    ConnectionString "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"C:\\Documents and Settings\\WindIce\\My Documents\\web\\App_Data\\Game.mdb\";Persist Security Info=True" string
    ConnectionTimeout 15 int
    Database "" string
    DataSource "C:\\Documents and Settings\\WindIce\\My Documents\\web\\App_Data\\Game.mdb" string
    Provider "Microsoft.Jet.OLEDB.4.0" string
    ServerVersion "04.00.0000" string
    State Open System.Data.ConnectionState

      

  7.   

    恩~~~好久没用Access了,傻掉了...6楼正解......
    原来真的是查询语句的错误,写成具体字段就好了.....
    谢各位大,锁了