SQL Server Compact Edition - Error Accessing in Production
I have developed a website which uses an SQL Server Compact Edition database (in the App_Data folder).
I can access it correctly (specifically a "Count" SQL instruction, to see if the User ID exists) on my local PC/Server, but when I upload the website to GoDaddy I get an error message when I go through the same exact steps/data input.
I have (in part):
var mbruserid = Request["userid"];
var db = Database.Open("SecondDeclarationOfIndependence");
var UserIDCount = 9;
The "9" was for earlier testing of the "Count" function.
ModelState.AddError("userid", "1 You must enter your User ID");
sql = "SELECT COUNT(*) FROM MemberDB WHERE CUserID = @0";
UserIDCount = db.QueryValue(sql, Request["userid"]);
<h2>Get Count of userid From Database</h2>
<p>UserIDCount = @UserIDCount</p>
tempUserIDCount = UserIDCount;
if(UserIDCount < 1)
ModelState.AddError("userid", "2 The User ID is invalid, please re-enter.");
<p>exception = @ex</p>
ModelState.AddFormError(@"3 An error occurred during sign in. Please try again. If you
continue to have problems, contact the Web Master from the Contact Us page. Please
include your User Id and a description of the problem.");
I had the following exception printed:
exception = System.Data.SqlServerCe.SqlCeException (0x80004005): Access to the database file is not allowed. [ 1914,File name = D:\Hosting\11144680\html\seconddeclarationofindepe ndence\App_Data\SecondDeclarationOfIndependence.sd f,SeCreateFile ] at System.Data.SqlServerCe.SqlCeConnection.Open(Boole an silent) at System.Data.SqlServerCe.SqlCeConnection.Open() at WebMatrix.Data.Database.EnsureConnectionOpen() at WebMatrix.Data.Database.QueryValue(String commandText, Object args) at ASP._Page_QXZYPages_MemberSigninInfo_cshtml.Execut e() in d:\hosting\11144680\html\SecondDeclarationOfIndepe ndence\QXZYPages\MemberSignInInfo.cshtml:line 53
The database has the same name as the website ("SecondDeclarationOfIndependence"), and the table name is "MemberDB"), could database name being the same as the websites be the problem?
Do I need to add instructions to the web.config (the book indicates that you do not)?
Last edited by PaulaThomas; October 28th, 2013 at 10:32 AM..