I am trying to retreive data from the Access Database from my ASP.Net application. It works when I access one table for an ExecuteScalar. but in the following code I get this error; Data source name not found and no default driver specified
private static string GetConnectionString()
{
string importFolder = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["DataPath"].ToString());
string fileName = ConfigurationManager.AppSettings["DataFile"].ToString();
return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + importFolder + fileName;
}
public DataTable getaddresses(string doorno, string Addsearch)
{
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(GetConnectionString());
DataTable dt = new DataTable();
string query = "SELECT * FROM Address_tble";
System.Data.Odbc.OdbcDataAdapter da = new System.Data.Odbc.OdbcDataAdapter(query, conn);
da.Fill(dt);
da.Dispose();
return dt;
}