错误 为 : “/news1”应用程序中的服务器错误。
--------------------------------------------------------------------------------无效的 SQL语句;期待 'DELETE'、'INSERT'、'PROCEDURE'、'SELECT'、或 'UPDATE'。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 无效的 SQL语句;期待 'DELETE'、'INSERT'、'PROCEDURE'、'SELECT'、或 'UPDATE'。
也可以用其他的办法!  有那个大哥会啊 帮帮我吧!!!!!!!

解决方案 »

  1.   

    行 42:  cmd=new OleDbCommand("strSelType  ",conn);
    行 43:  conn.Open();
    行 44:  pager.RecordCount=(int)cmd.ExecuteScalar();
    行 45:  conn.Close();
    行 46:  BindData();
      

  2.   

    原来你用的是Office中的数据库啊,怎么不用SQL Server了,那样就方便多了,可以用他的存储过程。
      

  3.   

    把你的strSelType打印出来放到access视图分析内执行一下
    看正确不?
      

  4.   

    哈哈 本问题  已经解决 !  谢谢   散分!!!!!!!!!!代码 如下
    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
     conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("db2.mdb"));
    if(!Page.IsPostBack)
    {
    int flid;
    if(Request.Params ["flid"]!="")
    {
    flid=System.Convert .ToInt32 (Request.Params ["flid"]);
    }
    else
    {
    flid=1;
    }
    string strSelType="select count(id) from news where flid='"+flid+"' ";
    cmd=new OleDbCommand(strSelType,conn);
    conn.Open();
    pager.RecordCount=(int)cmd.ExecuteScalar();
    conn.Close();
    BindData();
    }
    } void BindData()
    {
    int flid;
    if(Request.Params ["flid"]!="")
    {
    flid=System.Convert .ToInt32 (Request.Params ["flid"]);
    }
    else
    {
    flid=1;
    }
    string strSelType="select * from news where flid='"+flid+"' ";
        cmd=new OleDbCommand(strSelType,conn);
    OleDbDataAdapter adapter=new OleDbDataAdapter(cmd);
    DataSet ds=new DataSet();
    adapter.Fill(ds,pager.PageSize*(pager.CurrentPageIndex-1),pager.PageSize,"news");
    dg.DataSource=ds.Tables["news"];
    dg.DataBind();
    pager.CustomInfoText="记录总数:<font color=\"blue\"><b>"+pager.RecordCount.ToString()+"</b></font>";
    pager.CustomInfoText+=" 总页数:<font color=\"blue\"><b>"+pager.PageCount.ToString()+"</b></font>";
    pager.CustomInfoText+=" 当前页:<font color=\"red\"><b>"+pager.CurrentPageIndex.ToString()+"</b></font>";
    }