错误信息
System.ArgumentException: 不支持关键字: “provider”行 314: public static DataTable GetDataTable(string strSQL) 
行 315: { 
行 316: SqlConnection Conn = new SqlConnection(strConn);  
行 317: // DataTable datatable=new DataTable(); 
行 318: try
 原码
-------------------------------------------------------------------------using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
namespace Rose.DataClass
{ public class CDataBase
{ static string dppath =HttpContext.Current.Request.PhysicalApplicationPath + "\\" + ConfigurationSettings.AppSettings["Sql_Conn"];      
protected static string strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +dppath+";"; protected static string strSQL;
protected static SqlConnection Conn;
protected string strMessage;
protected static SqlConnection ConnDr; public CDataBase()
{
//
// TODO: 在此处添加构造函数逻辑
// }
public string Message
{
get
{
return strMessage;
}
set
{
strMessage = value;
}
} public static DataTable GetDataTable(string strSQL) 

SqlConnection Conn = new SqlConnection(strConn);  
// DataTable datatable=new DataTable(); 
try
{
Conn.Open();
SqlDataAdapter sda = new SqlDataAdapter(strSQL,Conn);
DataTable dt = new DataTable("dt");
sda.Fill(dt);
return dt;
}
catch(System.Data.SqlClient.SqlException e)
{
throw new Exception(e.Message);
}
finally
{
Conn.Close();
}
}

解决方案 »

  1.   

    System.ArgumentException: 不支持关键字: “provider”
    ===================================================
    不是你提供的protected static string strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +dppath+";";这一行它找到的错误是小写的(大小写不关键,但你的代码那里还有小写的provider)
      

  2.   

    好像不是这里的问题
    我改了成
    protected static string strConn="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);还是一样的错误
      

  3.   

    我的意思就是说你看其他地方是不是也写了这个provider
      

  4.   

    修改过后出现又出现这样的问题
    在 ConnectionString 中未指定 OLE DB 提供程序。示例为:“Provider=SQLOLEDB;”。 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentException: 在 ConnectionString 中未指定 OLE DB 提供程序。示例为:“Provider=SQLOLEDB;”。源错误: 
    行 313: public static DataTable GetDataTable(string strSQL) 
    行 314: { 
    行 315: OleDbConnection Conn = new OleDbConnection(strConn);
    行 316: // OleDbConnection connection = new OleDbConnection();
    行 317:
     
      

  5.   

    Data Source='fdc.mdb';Jet OLEDB:database password=123; Provider='Microsoft.Jet.OLEDB.4.0';User ID=Admin
    连接字符串
      

  6.   

    呀,LZ 你竟然要 SqlConnection 去连 Access ????请使用 OleDbConnection 以及相关类public static DataTable GetDataTable(string strSQL) 

    SqlConnection Conn = new SqlConnection(strConn); 
    //DataTable datatable=new DataTable(); 
    try
    {
    Conn.Open();
    SqlDataAdapter sda = new SqlDataAdapter(strSQL,Conn);
    DataTable dt = new DataTable("dt");
    sda.Fill(dt);
    return dt;
    }
    catch(System.Data.SqlClient.SqlException e)
    {
    throw new Exception(e.Message);
    }
    finally
    {
    Conn.Close();
    }
    }
    》》》
    public static DataTable GetDataTable(string strSQL) 

    OleDbConnection Conn = new OleDbConnection(strConn); 
    //DataTable datatable=new DataTable(); 
    try
    {
    Conn.Open();
    OleDbDataAdapter sda = new OleDbDataAdapter(strSQL,Conn);
    DataTable dt = new DataTable("dt");
    sda.Fill(dt);
    return dt;
    }
    catch(System.Data.OleDbClient.OleDbException e)
    {
    throw new Exception(e.Message);
    }
    finally
    {
    Conn.Close();
    }
    }
    Good Luck!
      

  7.   

    这个问题我刚才就改过来了
    现在又有问题了!异常详细信息: System.Exception: 找不到可安装的 ISAM。我用的是:
    protected static string strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);连接的
      

  8.   

    郁闷死了。本来用SQL都做好了,空间不支持SQL的,只支持access,改起来好痛苦