Im using this code to connect to access 2007 database :
public void RetrieveData(){
OleDbConnection conn=null;
OleDbDataReader reader=null;
string strConnection= @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\PC\\Documents\\School.accdb;Persist Security Info=False;";
try
{
conn = new OleDbConnection(strConnection);
conn.Open();
OleDbCommand cmd = new OleDbCommand("select * from Class", conn);
reader = cmd.ExecuteReader();
DataList1.DataSource = reader;
DataList1.DataBind();
}
catch (Exception e)
{
Response.Write(e.Message);
Response.End();
}
finally
{
if (reader != null) reader.Close();
if (conn != null) conn.Close();
}
}
but when i run it it jus give blank page.in debug mode I can see that the database property of conn is empty “” what would it be the problem?
in the web.config
and from the code behind use this
reply if it is useful or not