An Example


		//*****************************************
		//*****************************************
		//********** INITIALISE DATABASE **********
		//*****************************************
		//*****************************************
		bool InitialiseDatabase()
		{
			System.Data.SQLite.SQLiteConnection Connection1 = null;
			String sTemp;

			try
			{

				//----- OPEN THE DATABASE CONNECTION -----
				Connection1 = new 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 = new System.Data.SQLite.SQLiteCommand(Connection1);

				//----- CREATE MY TABLE IF NECESSARY -----
				sTemp = @"CREATE TABLE IF NOT EXISTS IF NOT EXISTS tblLogEvents ( 
										Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
									MyIntigerField INTEGER, 
                                    MyNumericField NUMERIC, 
                                    MyRealField REAL, 
                                    MyTextField TEXT 
									)";
				Command1.CommandText = sTemp;
				Command1.ExecuteNonQuery();

				return(true);
			}
			catch (Exception err)
			{
				MessageBox.Show("Error:\n" + err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return(false);
			}
			finally
			{
				//----- CLOSE THE DATABASE CONNECTION -----
				try
				{
					if (Connection1 != null)
						Connection1.Close();
				}
				catch (Exception)
				{
				}
			}
		}

Unique Columns


CREATE TABLE bookmarks(
    users_id INTEGER,
    lessoninfo_id INTEGER,
    UNIQUE(users_id, lessoninfo_id)
);

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.