I finished my c# Click once application, so I published it.
The problem with it is, that I'am using a small SQLite database, for keeping settings and a lot of other small things, which will get overwritten by the new SQLite database, every time I update my application.
There are settings in the database like: Remember password and Remember username, there is also a counter, that counts how many times the application has been started. All of that will be lost and the user will have to fill in his username and password again, even if he checked the boxes to remember, because the database will be overwritten.
Question: How do I prevent to SQLite Database from getting overwritten in my Click Once application?
I used the following link to solve my problem:
http://robindotnet.wordpress.com/2009/08/19/where-do-i-put-my-data-to-keep-it-safe-from-clickonce-updates/
This article explains how I can create my Database in the roaming folder of AppData, create a folder there called like your company name or the name of your application and put the Database in that folder.
You should have "Template" database which will always override and created database with data which will not override after installing of new version of application.
The database with data should be created if it doesn't exist at startup of application.
Related
I would like your opinion.
I am creating a WinForm application (C#) and I would like to know if there is any problem using a local database to save the application settings instead of app.config. My system constantly retrieves configuration data to continue processes, but there are not many requests or require data with great information, just to validate whether one configuration or another is activated.
I already use mdf file to generate some filters, I was wondering if there is a problem putting the application settings in it.
My mdf file is 8mb in size, practically the standard when it is created, and will not store much information in it.
I have an app where user can work on a file downloaded from database. When file is downloaded, in database query is run setting "owner" value in corresponding table row. As a result other users see that file is owned by somebody else and can only read from it, not modify it. After work session user saves file to database and sets "owner" to none allowing other users access file. This works fine till app crashes or there is power shortage or some error in system that terminates app leaving database entries "reserved". In case of crash I can follow this approach :
WPF global exception handler
and try to connect to database to "free" all files reserved by user, but in other cases as my research has shown there is no way how to know that program failure has occured and I should "free" database so other users can access previously reserved files. Is this way how to show other users that something in database is not awailable for editing is in general bad design or there are solutions to this type of a problem?
I have a simple question. I'm new to .net and sql and I'm trying to write a small form application. I added a data source which I created in sql. I got textboxes, button to update tables in database. When I made changes in database, like adding or deleting rows from tables, these updates are getting lost if I made a little change in application code (for example entering a new line).
Probably I'm unaware of something simple. What is the cause of it?
Select the database from solution explorer, go to properties (or alt + enter) and change the Copy to Output Directory to Copy if newer (copy if you change the database) or Do not copy. If the selected option is Copy always, the database is copied each time the project is build.
I've created this small tool in C# that deletes a record in a database. So instead of opening and writing SQL I now just enter the specifics and the small application deletes it for me.
But now I need to allowe everyone access to this small application. So I need a way to log what they user deleted (recordid and stuff). Could I just plainly do a write to file? What happens if two or more users are using the application at the same time?
The question might be what exectaly you want to achive. where you want to write log into sql database or into files. or you want to send an email to your self or somebody else. if you have one of these question in your mind. just use LOG4NET
What you have to do is use this utility into your application and add its logging into desire location.
if you want to log into sql server what you can do is use Delete trigger in your tables and log what users have deleted.
For example I have developed c# application (with sql database) and installed on win OS, then use to save some data. Now I need to install new window, what did happen with my saved data?
Generally the data you are referring to might be either created during the installation or when the program itself is used (like an OLTP applicaiton). If lets say you have followed all the best practices and created the application using the created installation package, then the uninstaller should give you the option to either store your preferences like template and layout and such(if your program supprts those kind of things). But as for the data and even more in your case data stored in SQL is not deleted UNLESS you specifically mention in the uninstallation to drop the table or database. So as you are mentioning new window, just ensure the database exists and all the data is in contact(most likely it will be). Then also ensure that the new window is pointing to the data with all the necessary constrings and authentication.