日期:2014-05-18  浏览次数:20926 次

晕了晕了 几句话都出错。好久没做了数据库大家帮看下
public DB() { 
  strCon = @"Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = f:\tool\package\anforma_AU\pack_tool_zerogra_1.00_自动版\pack_tool\bin\Debug\config\database\database\AU_DB.mdb"; 
  } 

  public void getDB() { 
  try { 
  if (sqlCon==null) 
  sqlCon = new OleDbConnection(strCon); 
  if (sqlCon.State != ConnectionState.Open) 
  sqlCon.Open(); /////////打开这个始终出错
  ds = new DataSet(); 
  string strCom = "select * from auTable"; 
  sqlDA = new OleDbDataAdapter(strCom, sqlCon); 
  sqlDA.Fill(ds, "auTable"); 

  sqlCon.Close(); 

  BusinessEntity.DataSet = ds; 
  } 
  catch { } 
  }

连接access需要配置什么吗,难道我没配置?

------解决方案--------------------
C# code

strCon = @"Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = f:\tool\package\anforma_AU\pack_tool_zerogra_1.00_自动版\pack_tool\bin \Debug\config\database\database\AU_DB.mdb";

  sqlCon = new OleDbConnection(strCon);