INSERT Example String ^sTemp = "INSERT INTO myTable ( \ SomeValueColumn, \ SomeStringColumn \ ) Values ( \ @SomeValue, \ @SomeString \ )"; Command1->CommandText = sTemp; //Strings should be added as parameters to avoid sanatisation risks unless you know they are safe. //Other values can be added as parameters too or inline in the INSERT […]
All posts by
Create New Database
Create Database File Example #define SQLITE_DATABASE_FILE_PASSWORD "mypasswordgoeshere" //Set as "" for no password bool DatabaseSqlite::CreateDatabase(void) { String ^FilePath; System::Data::SQLite::SQLiteConnection ^Connection1; try { //—– CHECK DIRECTORY EXISTS —– if (!Directory::Exists(Environment::GetFolderPath(Environment::SpecialFolder::ApplicationData) + "\\" + Application::CompanyName + "\\" + Application::ProductName + "\\")) Directory::CreateDirectory(Environment::GetFolderPath(Environment::SpecialFolder::ApplicationData) + "\\" + Application::CompanyName + "\\" + Application::ProductName + "\\"); //—– CREATE NEW DATABASE —– […]
user_version Pragma
The user_version pragma gets or sets the user-defined version value that is stored in the database header. Following is the simple syntax: PRAGMA [database.]user_version; PRAGMA [database.]user_version = number; This is a 32-bit signed integer value which can be set by the developer for version tracking purpose. Default value is 0. Using user_version for database updating […]
Add new column
Adding a new column ALTER TABLE tbl_status ADD COLUMN status_default TEXT; This will cause an error if the column already exists. To check if a column already exists first you can use: PRAGMA table_info(tbl_status); which will return a table listing the columns of the table. However many people use the built in PRAGMA user_version) to store […]
Target Framework
In VS2013 this isn't settable within VS itself. To view the target framework Project Properties > Common Properties Ifa target framework is set (not all applications need it) then it is displayed above the right side main box(es). To set / change a target framework Close the project. Open the projects .vcxproj with notepad. Find the […]
Creating Tables
Good Resources https://www.sqlite.org/lang_createtable.html An Example bool DatabaseSqlite::InitialiseDatabase(void) { System::Data::SQLite::SQLiteConnection ^Connection1; String ^sTemp; try { //—– OPEN THE DATABASE CONNECTION —– Connection1 = gcnew System::Data::SQLite::SQLiteConnection(“data source=” + Environment::GetFolderPath(Environment::SpecialFolder::ApplicationData) + “\\” + Application::CompanyName + “\\” + Application::ProductName + “\\mydatabasefile.db;Password=” + SQLITE_DATABASE_FILE_PASSWORD); Connection1->Open(); System::Data::SQLite::SQLiteCommand ^Command1 = gcnew System::Data::SQLite::SQLiteCommand(Connection1); //—– CREATE MY TABLE IF NECESSARY —– sTemp = “CREATE […]
DateTime
https://www.sqlite.org/lang_datefunc.html Reading DateTime In Select Statements You need to specify you want the value returning in a DateTime format or you can just get the year portion returned! Command1->CommandText = "SELECT datetime(LogDateTime) as LogDateTime, SomeOtherColumnName FROM MyTable"; Faster Searches Based On Date One nice and simple solution is to store dates as an intiger using this […]
.Columns General
See our C# page here.
Translation Editing Software
Visual Studio You can of course use Visual Studio, but its not a great way to do multiple languages. Zeta Resource Editor https://www.zeta-resource-editor.com/ Free language editor tool. Simply give it a AppLocalization.resz file for language. Each is shown in the editor simply as a new column. lingohub.com Setup A New Lingohub Project On each of […]
Providing Translations via the Visual Studio IDE
On your form you wish to localize for a language change the property Localizable to true. Then change the Language property to the language you wish to set up a new resource file for. Change all the text on the form to the new language. This will create an additional resx file for each […]
