How to update a database programmatically, so that the updated one is included when publishing? - c#-4.0

I'm copying and updating data from another database to mine (programmatically), this works fine when debugging. It also remembers it between debugging sessions. However, when I publish the program, the original database is empty.
How do I make sure the updated one is included?
This is an SQLCE database by the way.

When you are debugging the compiler will copy your SqlCe database to the bin\debug folder and that's the one you will be using when your program is running.
So when you copy data while debugging it will not end up in the database that is a part of your project but in the one in the debug folder!
Using the following tool could help. This will allow you to script the data that's in your database to a sql script so you can run it in your publish environment.

Related

setup project for visual studio application using advanced installer with local db data is retrieved but not saved in db

I am using advanced installer (simple) to create the setup project of a GUI i am making in visual studio. upon installation, it is possible to read data from the databse i.e the records that are already added can be read but as i try to save data in databse that function is not working and the application stops working. i think that the connection string is right that is why iam able to read data from it but why cant i update data. plz help.
the databse is is service-based local database
This might happen if you have the database stored in the same install location as your application binaries. Usually that is a folder under Program Files.
You're application cannot write under this location when running as a standard user, and it should never write/store data in that location.
If you're not using the Application Data folder to store your database, I suggest you update your app to do so, this should solve your problem.

InstallShield (InstallScript Project): Uninstall files at update - How can I prevent this?

I'm quite new in the InstallShield stuff, I took this project from a leaving co-worker. However, here's my problem:
I was trying to update a MySQL Server with the setup from 5.7.17 to 5.7.19, which works great most of the times.
I got the feature "MySQL", splitted in "MySQL Data" (includes the performance_schema and mysql database), "MySQL Service" (Service batch files) and "MySQL Binaries" (the files).
For the update, I just changed the binaries by the new one and left the rest. All features are selected and my log tells me, that it installs all files which it hasn't installed by now, leaving the existing files untouched. As this is an update, it seems correct to me.
But sometimes, at the end of the setup process, it uninstalls almost anything of my MySQL Feature again; the databases, the batch files and almost any core file which wasn't changed by the setup before. But why is that and how can I stop my setup from do so?
Kind regards
I think what you're describing is that your file containing the data is not getting updated. Since this type of file cannot be versioned, that's what Windows installer uses to determine whether or not to upgrade the file, you will need to mark the component containing this file to Always Overwrite. Check out the MS docs for the Component table for how to do this with the Attributes field.
You may want to check the conditions on the components in question. Also, check the install sequence to see if it is calling uninstall out of sequence.

How can I bundle my database file into my app, ready for a side load install?

I am creating a Windows 10 Universal App which uses a local SQLite Database.
In order for the app to use the database file It must be placed in:
C:\Users\<Username>\AppData\Local\Packages\<Name of Package>\Local State
Now I understand this is the 'local' file structure for the application. However I have a pre-made database that the app needs to interact with and therefore should be bundled as part of the app on install.
Is there a method of including my database in a usable fashion when distributing my application via a side-load install?
Furthermore, This problem is of paramount importance as This 'C:\' Directory will not exist when pushing my application to the mobile phone or other Windows 10 (not a desktop) device.
You cannot package the database directly as read-write data (local state). If you only ever need to read from the database, you can just include it in your project and read it from Package.Current.InstalledLocation.
If you need to write to the database, but it contains some initial values you want to ship with your app, then you still need to include the database in your project, but then copy it from the InstalledLocation to ApplicationData.Current.LocalFolder if it doesn't exist when your app starts up.
You can all ways export your existing data base as SQL script and save it in your project assets.
On the first run of your application you can create the Sqlite file in your LocalFolder, and run the script with CREATE and INSERT queries.

Kofax project and batch class

Kofax Capture Version 9
I have an existing Project and Batch class that works, built previously by Kofax engineer.
What I need to do is change the script in the project to use a new DB connection. This seemed simple enough.
Using project builder I copied the existing project, altered the script and saved the project. Using Capture Administration I copied the existing batch class and then used Synchronize Kofax Transformation Project and pointed to the new project. All this seemed to work without error.
However the script being executed is the original not my altered one, any guidance would be great.
Make sure you are creating a new batch after publishing your change. The batch class class update function works in very limited scenarios, so I don't generally recommend it.
There are many ways that a database connection might be handled in script. Usually I would expect that a function at the project script level handles the connection and is called from any sub class, but you might want to check any sub classes to make sure they aren't using locally defined connection strings.
Even if you are making a connection in script (which you've now changed), you might also be using product features that use databases. Open Project Settings and check the Databases tab.
If there are relational databases listed, simply change as needed.
If you are actually using "Remote Fuzzy" databases then these might be using Kofax Search and Matching Server which connects to a relational database to build the fuzzy db. In this case you would need to use KSMS Admin to change the connection on the KSMS server.
If you are using "Local Fuzzy" databases then the info is based on the content of a text file. You might have some external process (possibly Markview) that dumps this text file from a database.

Restoring a MySQL database on a potentially different MySQL installation?

I have a broken installation of Ubuntu 14.04 - it won't boot, but I won't say anymore about that because that's not what I'm asking about really. I have a MySQL database (created using v5.5) on the broken Ubuntu installation and I need that data. I can get at the raw MySQL database files by mounting the broken installation onto another machine.
I actually need the database to be imported into a MySQL v5.1 installation. I tried copying the raw database files (e.g. the directory at /var/lib/mysql/dbname) into the same directory on the working OS installation. At first, it seemed like it worked, I can see the database, I can use it and I can list the tables. But it turns out that even though I can see the tables in the db, any attempts to describe or use them in any way give the 'table doesnt exist` error.
Ideally, I'd love to be able to use msqldump and then import the database the proper way, but how can I get a dump of the database if it's not part of the MySQL installation (remember, I can't boot into the installation, it's broken).
Of course, mysqldump is the most preferable solution, but if it's not possible to use that utility with the raw database files as input, then I'm willing to try anything that might work.
Of course the first thing you should do is to install the same version of MySQL as the original - if you're directly using the raw data files, keeping things as identical to the original as possible is a must! The same applies to paths, make sure the new installation and data files are placed in the same directory path that they were originally.
Once you have this, you can mysqldump the tables and use that to import into a clean, new installation.

Resources