Vals0ray 17 / 17 / 14 Регистрация: 23.02.2017 Сообщений: 48 |
||||||||
1 |
||||||||
SQLite Не добавляет в даблицу новые даные30.05.2019, 22:26. Показов 1370. Ответов 6 Метки нет (Все метки)
Всем доброе время суток. В своем WPF проекте я использую SQLite при помощи EF6. При помощи СУБД DB Browser for SQLite, создал БД, таблицы и добавил их в корень проекта. Создал строку подключения, модель, контекст. Вообщем даные с БД я получить и работать с ними могу без проблем вот таким способом:
А вот когда пытаюсь дабавить новые:
То ничего не происходит, в СУБД новых данных нету. Подскажите в чем может быть проблема(((
__________________
0 |
6270 / 3898 / 1567 Регистрация: 09.05.2015 Сообщений: 9,188 |
|
30.05.2019, 22:28 |
2 |
То ничего не происходит, в СУБД новых данных нету. Подскажите в чем может быть проблема((( Как проверяете что новых данных нет?
1 |
17 / 17 / 14 Регистрация: 23.02.2017 Сообщений: 48 |
|
30.05.2019, 22:35 [ТС] |
3 |
Someone007, Снова открываю файл с БД в DB Browser for SQLite и новых даных нету. Да и когда повторно запускаю приложение, то в списке Users который получает даные с таблицы Users нету ранее добавленных значений.
0 |
6270 / 3898 / 1567 Регистрация: 09.05.2015 Сообщений: 9,188 |
|
30.05.2019, 22:37 |
4 |
Файл БД при компиляции случайно не копируется каждый раз в папку с ехе файлом заменяя старый?
1 |
17 / 17 / 14 Регистрация: 23.02.2017 Сообщений: 48 |
|
30.05.2019, 22:49 [ТС] |
5 |
Без понятия, а как это проверить? Добавлено через 2 минуты Добавлено через 8 минут
0 |
6270 / 3898 / 1567 Регистрация: 09.05.2015 Сообщений: 9,188 |
|
30.05.2019, 22:51 |
6 |
Сообщение было отмечено Vals0ray как решение Решение Раз говорит нету таблицы, значит её нету.
1 |
17 / 17 / 14 Регистрация: 23.02.2017 Сообщений: 48 |
|
30.05.2019, 23:01 [ТС] |
7 |
Я идиот, я два часа постоянно проверял не тот файл БД. Не тот что лежал рядом с .exe, а тот что в другой папке. Откуда их там несколько взялось)))) Спасибо вам, все заработало.
0 |
- Remove From My Forums
-
Question
-
Hello, I tried to use Entity Framework Core and SQLite, when I deploy the program, it contains error SQLite Error 1: ‘no such table: Goal’ on this line:
public static List<Goal> GetGoals() { using (var db = new GoalDataContext()) return db.Goals.ToList(); //this line }
Goals is my Table name.
This is my Goal class that I have migrated:
[Table("Goal")] public class Goal { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int GoalId { get; set; } public string nama { get; set; } public double berat { get; set; } public double tinggi { get; set; } public int umur { get; set; } public string gender { get; set; } public double calorieGoal { get; set; } public double calorieToday { get; set; } public List<GoalTracker> GoalTrackers { get; set; } }
and this is the GoalDataContext class:
public class GoalDataContext : DbContext { public DbSet<Goal> Goals { get; set; } public DbSet<GoalTracker> GoalTrackers { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite("Filename=CalorieTracker.db"); } }
-
Edited by
Monday, December 12, 2016 3:00 PM
adding class code
-
Edited by
Answers
-
Finally! I found what’s wrong with my code!
The name of table on class should same with the name of table on migration.
I recheck on migration output and Goal class, the name is different, so I re-migrated after edit it.
-
Proposed as answer by
Barry Wang
Tuesday, December 13, 2016 8:36 AM -
Marked as answer by
Olivia Olga
Wednesday, December 14, 2016 2:35 AM
-
Proposed as answer by
Сначала я пытаюсь реализовать этот вопрос с помощью кода SQLite и EntityFramework 6. Я могу создать базу данных, и есть файл (хотя и пустой), но когда я пытаюсь добавить запись в базу данных, он говорит, что такой таблицы нет. Тем не менее, когда я пытаюсь создать таблицу вручную (db.Database.ExecuteSqlCommand("CREATE TABLE etc.)
), Он сообщает мне, что таблица уже существует.
Я уже нашел некоторые вопросы об этом, но все они касаются того, что путь не является абсолютным, что здесь просто не так.
контекст
//Context:
class MediaContext : DbContext
{
public DbSet<MediaModel> Media { get; set; }
public MediaContext(string filename): base(new SQLiteConnection() {
ConnectionString =
new SQLiteConnectionStringBuilder()
{ DataSource = filename, ForeignKeys = false }
.ConnectionString
}, true)
{
}
}
DAL
//In the DAL:
public DataAccessLayer(string path)
{
_path = Path.GetFullPath(path); //<--The path already comes full in, I'm just paranoid at this point.
_connectionPath = _path + @"MyDatabase.sqlite";
using (var db = new MediaContext(_connectionPath))
{
db.Database.CreateIfNotExists();
db.Database.Initialize(false);
db.SaveChanges();
}
public void Generate()
{
using (var db = new MediaContext(_connectionPath))
{
db.Media.Add(new MediaModel("test"));
db.SaveChanges(); //<--SQLiteException: SQL logic error or missing database: no such table: MediaModels
}
}
App.Config
//App.config:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>
Содержание
- SQL logic error or missing database no such table: folders #257
- Comments
- Sql logic error or missing database no such table
- Comments
- Failed to connect: SQL logic error or missing database no such table: RemoteOperation #2007
- Comments
- Version info
- Bug description
- Screenshots
- debug log
SQL logic error or missing database no such table: folders #257
I was using cmissync 1.0.7 with alfresco 4.0 over SSL on Windows 7 64bits and everything was ok, but yesterday I try to install it to one workmate on Windows 7 64bits and It crash everytime we open it. I’m gonna try to install in other Windows 7 64bits laptop and let you know what’s going on 😉
The text was updated successfully, but these errors were encountered:
Thank you for the feedback!
Dies 1.0.0 work better?
Could you please post the log?
Thank you!
Nicolas Raoul
On Nov 21, 2013 4:48 PM, «antton» notifications@github.com wrote:
I was using cmissync 1.0.7 with alfresco 4.0 over SSL on Windows 7 64bits
and everything was ok, but yesterday I try to install it to one workmate on
Windows 7 64bits and It crash everytime we open it. I’m gonna try to
install in other Windows 7 64bits laptop and let you know what’s going on 😉
—
Reply to this email directly or view it on GitHubhttps://github.com/nicolas-raoul/CmisSync/issues/257
.
I didn’t have enough time to test the version 1.0.0 but talking about 1.0.7, the problem was that the previous instalattion let me the config file on AppData/cmissync folder and when I open on windows 7 64 bits the first time it crash. (so there is no relation with 64bits, sorry!)
But know I’m having a the following problem (I paste the log in spanish)
Let me know if you want to try the version 1.0.0 yet.
Thanks for the feedback! I edited the issue’s title.
Do you know how to reproduce the problem?
It sounds like #84 which I don’t know how to reproduce, so your help would be great!
Could you please check whether your cmissync.sqlite file contains a «folders» table (you can see with SQLite Browser, open the database in C:UsersnicoAppDataRoamingcmissync or similar).
Thanks a lot!
Nicolas
As I couldn’t find the database file, in that folder, I decided to remove cmissync completly and reinstall again. Now It works properly. The only thing I saw strange was that In uninstall window in windows7 the version 1.0.7 appers as 1.0.6.
That’s all. Thanks for everything.
The database is a file called for instance myfolder.cmissync .
I will now close this issue, but could you please write a small summary of how you solved the issue on #84 ? Thanks a lot!
Источник
Sql logic error or missing database no such table
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I’m trying to use this great library and I just cannot get the tables created at startup. The SQLite file is created, but with a 0 size.
This is my DB context code:
().HasKey(p => p.id); > private static void ConfigureServerEntity(DbModelBuilder modelBuilder) < modelBuilder.Entity ().HasKey(p =>p.id); > > «>
The text was updated successfully, but these errors were encountered:
Which version do you use? This should be fixed with v1.0.0.0 (see issue #43).
Did you try to delete the empty file and run the application again?
If you are using the newest version and the issue persists, can you please send me the whole project?
Thank you very much for responding. I did try to delete the empty file and I am using v1.0.0.0.
I’ll add you to the Github repo where the project is.
I had a look at your code. I created a Console Project to reproduce the issue.
But I’m not able not find a class «Server». I took the classes From «SqliteStructures» and created a DbContext with the code you posted in the issue description.
May you can help me with creating a project to reproduce this issue?
You can download the Console Project here:
https://onedrive.live.com/redir?resid=C8E1BE3E79378699!523889&authkey=!ABUB4-pZYfcgYhw&ithint=file%2czip
Closed because auf inactivity.
Please reopen it, if additional actions are required.
Источник
Failed to connect: SQL logic error or missing database no such table: RemoteOperation #2007
- [x ] searched open and closed issues for duplicates
Version info
Duplicati Version: v2.0.1.26-2.0.1.26_canary_2016-09-29
Operating System: Windows 10 Pro
Backend: Local Folder that’s uploaded automatically to the cloud
Bug description
I can’t start the backup.
Screenshots
debug log
I changed the target directory for the backup, now I’m getting this:
System.Data.SQLite.SQLiteException (0x80004005): SQL logic error or missing database no such table: RemoteOperation at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain) at System.Data.SQLite.SQLiteCommand.BuildNextCommand() at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at Duplicati.Server.WebServer.RESTMethods.LogData.DumpTable(IDbCommand cmd, String tablename, String pagingfield, String offset_str, String pagesize_str) at Duplicati.Server.WebServer.RESTMethods.Backup.FetchRemoteLogData(IBackup backup, RequestInfo info) at Duplicati.Server.WebServer.RESTHandler.DoProcess(RequestInfo info, String method, String module, String key)
The text was updated successfully, but these errors were encountered:
Источник
- home
- articles
-
quick answersQ&A
- Ask a Question
- View Unanswered Questions
- View All Questions
- View C# questions
- View Python questions
- View Javascript questions
- View C++ questions
- View Java questions
-
discussionsforums
- CodeProject.AI Server
- All Message Boards…
- Application Lifecycle>
- Running a Business
- Sales / Marketing
- Collaboration / Beta Testing
- Work Issues
- Design and Architecture
- Artificial Intelligence
- ASP.NET
- JavaScript
- Internet of Things
- C / C++ / MFC>
- ATL / WTL / STL
- Managed C++/CLI
- C#
- Free Tools
- Objective-C and Swift
- Database
- Hardware & Devices>
- System Admin
- Hosting and Servers
- Java
- Linux Programming
- Python
- .NET (Core and Framework)
- Android
- iOS
- Mobile
- WPF
- Visual Basic
- Web Development
- Site Bugs / Suggestions
- Spam and Abuse Watch
-
featuresfeatures
- Competitions
- News
- The Insider Newsletter
- The Daily Build Newsletter
- Newsletter archive
- Surveys
- CodeProject Stuff
-
communitylounge
- Who’s Who
- Most Valuable Professionals
- The Lounge
- The CodeProject Blog
- Where I Am: Member Photos
- The Insider News
- The Weird & The Wonderful
-
help?
- What is ‘CodeProject’?
- General FAQ
- Ask a Question
- Bugs and Suggestions
- Article Help Forum
- About Us
See more:
This is what the details in the dialog box presents —
—
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** code = Error (1), message = System.Data.SQLite.SQLiteException (0x800007BF): SQL logic error no such table: Settings at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain) at System.Data.SQLite.SQLiteCommand.BuildNextCommand() at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at .(SQLiteCommand ) at .(String ) at .() at uY"~$JKnF!}Rz7GJ1L%EkG&0$.(Object , EventArgs ) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll ---------------------------------------- syscrb Assembly Version: 6.0.1.0 Win32 Version: 1.1.2.3 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/syscrb.exe ---------------------------------------- iBDSCzHXHlBRwihhbyyMXAwrCbyBA Assembly Version: 0.0.0.0 Win32 Version: 1.1.2.3 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/syscrb.exe ---------------------------------------- Microsoft.VisualBasic Assembly Version: 10.0.0.0 Win32 Version: 14.8.4084.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.8.4200.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.8.4084.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.8.4084.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- System.Runtime.Remoting Assembly Version: 4.0.0.0 Win32 Version: 4.8.4084.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll ---------------------------------------- MonthC Assembly Version: 1.0.2.0 Win32 Version: 1.0.1.0 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/MonthC.DLL ---------------------------------------- hotkeyMan Assembly Version: 1.2.3.0 Win32 Version: 1.2.0.0 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/hotkeyMan.DLL ---------------------------------------- KeyCapEngine Assembly Version: 2.1.4.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/KeyCapEngine.DLL ---------------------------------------- System.Data.SQLite Assembly Version: 1.0.111.0 Win32 Version: 1.0.111.0 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/System.Data.SQLite.DLL ---------------------------------------- System.Data Assembly Version: 4.0.0.0 Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll ---------------------------------------- System.Transactions Assembly Version: 4.0.0.0 Win32 Version: 4.8.4084.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll ---------------------------------------- System.EnterpriseServices Assembly Version: 4.0.0.0 Win32 Version: 4.8.4084.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll ---------------------------------------- tgrid Assembly Version: 1.0.3.0 Win32 Version: 1.0.1.0 CodeBase: file:///C:/Program%20Files/Best%20Free%20Keylogger/tgrid.DLL ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.
———-
What I have tried:
I have tried automatic repair and enabled debugger mode, both features of Windows 10.
Updated 31-Oct-20 21:22pm
1 solution
Solution 1
Without your code we can’t be specific, but the error message is pretty clear:
SQL logic error no such table: Settings
The database file you are accessing does not contain a table called «Settings».
The only way to «clear that error» is to either create a table called Settings and populate it, or make sure you are accessing the right database file.
We can’t do either of those for you!
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Top Experts | |
Last 24hrs | This month |
CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900