Hello. I think this should be a fairly easy question, but I am having problems.
I am using Visual Web Developer 2008, ASP.NET 2.0 and C#.
I have two main folders: WebSite1, and MDB. I store my .aspx files in the WebSite1 folder, and my MS Access database in the MDB folder.
Now, for my AccessDataSources, I have:
1 <asp:AccessDataSource ID="AccessDataSource1" runat="server"
2 DataFile="../MDB/site.mdb" SelectCommand="SELECT RegionID, RegionName
3 FROM tblRegion
4 ORDER BY RegionName"></asp:AccessDataSource>
As you can see, my mdb file is named "site.mdb". When I do this, I get the following error:
Failed to map the path '/MDB/site.mdb'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Failed to map the path '/MDB/site.mdb'.
Source Error:
Line 20: {
Line 21: DropDownList1.Items.Insert(0, new ListItem("- Select One - ","0"));
Line 22: DropDownList1.DataBind();
Line 23: DropDownList2.Items.Insert(0, new ListItem("- Select One - ","0"));
Line 24: DropDownList2.DataBind(); |
BTW, the DropDownList1 is populated from AccessDataSource1.
When I write out the entire path to the file on my hard drive (Line 2), it works. But, I don't want to do this, because it will cause problems when I upload to a web server.
Am I using the correct convention "../MDB/site.mdb"? Or is it something else? I tried the "~/MDB/site.mdb" already too.
Thanks!