- C# code
OleDbConnection connection = new OleDbConnection(ConfigurationManager.AppSettings["sql"]); string sql = "select * from [SalesInfo]"; OleDbDataAdapter da = new OleDbDataAdapter(sql, connection); DataSet ds = new DataSet(); da.Fill(ds);
- XML code
<appSettings> <add key="sql " value="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\SalesProjects\App_Data\1.accdb;Persist Security Info=True "/> </appSettings>
哪里出错了 没搞错access数据库- -
------解决方案--------------------------------------------------------
还没有open
就是connection。open();
------解决方案--------------------------------------------------------
key="sql "有空格