Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Beginning ASP.NET Web Pages with WebMatrix
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 28th, 2013, 10:28 AM
Registered User
Join Date: May 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.");
catch(Exception ex)
<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)?

Any suggestions?

Last edited by PaulaThomas; October 28th, 2013 at 10:32 AM..
Old October 28th, 2013, 11:57 AM
Wrox Author
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts

Hi Paula,

This is a permissions issue. The user account needs MODIFY (Read/Write) permissions on the database file. Your hosting provider should be able to help you set that up.
Old October 28th, 2013, 02:00 PM
Registered User
Join Date: May 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you for your response.

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server Developer edition katty.jonh Windows Server 1 July 25th, 2012 04:21 AM
Accessing Sql compact edition through Native C++ v_ganeshraju C++ Programming 0 August 17th, 2009 12:34 PM
Accessing Sql compact edition through Native C++ v_ganeshraju Visual C++ 0 August 17th, 2009 12:32 PM
SQL Server 2005 Express Edition: Error message jsbotts713 SQL Server 2005 1 September 26th, 2007 02:03 PM
SQL Server developer edition shahchi1 SQL Server 2000 1 January 12th, 2004 04:06 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.