I am trying to connect my MS Access Db with my asp.net website. When I run my code(on localhost only) it does not show any error or exception but it just wait for server to response. I am following code :
string connection = "Provider =Microsoft.ACE.OLEDB.12.0; datasource=I:/Adittya/test.accdb";
string query = "select * from test";
OleDbConnection con = new OleDbConnection(connection);
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = query;
cmd.CommandType = CommandType.Text;
OleDbDataReader dr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
testGrid.DataSource = dt;
testGrid.DataBind();
One more thing my DB is in my pen-drive whose location is static.
Do I have problem with my code or we cannot connect to DB present in pen-drive.