在此行向数据库添加数据(在Windows手机应用程序上)时出现此错误:
if (concac.DatabaseExists())
{
concac.Cacs.InsertOnSubmit(fullname);
concac.SubmitChanges();
}
这就是错误:
{System.Data.SqlServerCe.SqlCeException: Permission denied.
at System.Data.SqlServerCe.SqlCeDataReader.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeResultSet.InternalInsert(Boolean fMoveTo, Object sender, SqlCeUpdatableRecord record)
at System.Data.SqlServerCe.SqlCeResultSet.Insert(SqlCeUpdatableRecord record, DbInsertOptions options)
at System.Data.Linq.ChangeDirector.StandardChangeDirector.DoResultSetInsert(TrackedObject item)
at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)
at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at System.Data.Linq.DataContext.SubmitChanges()
at Member.DBHelper.AddName(Cac1 fullname)
at Member.Add.appBarOkButton_Click(Object sender, EventArgs e)
at Microsoft.Phone.Shell.ApplicationBarItemContainer.FireEventHandler(EventHandler handler, Object sender, EventArgs args)
at Microsoft.Phone.Shell.ApplicationBarIconButtonContainer.ClickEvent()
at Microsoft.Phone.Shell.ApplicationBar.OnCommand(UInt32 idCommand, Boolean isButton)
at Microsoft.Phone.Shell.Interop.NativeCallbackInteropWrapper.OnCommand(UInt32 idCommand, Boolean isButton)}
答案 0 :(得分:1)
听起来我需要检查数据库的权限。例如,在MSSQL中,您必须在使用SELECT或UPDATE语句时授予权限(每个用户)。