public AddForm() { InitializeComponent(); addToBase = new AddToDatabase(); //IDTB.Text = Guid.NewGuid().ToString(); //DetailsDict = new Dictionary<string,string>(); }
async Task AddVnExecute() { AddToDatabase.CreateAddVnVariables(AddVnModel.VnId, AddVnModel.ExePath, null, null); if (await CheckVnId() == 0) { worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; worker.DoWork += worker_DoWork; worker.ProgressChanged += worker_ProgressChanged; worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_completed); worker.RunWorkerAsync(); } }
// the main tasks of an update public static void MainTasks(string year) { // download file DownloadFile dlf = new DownloadFile(year); string success = dlf.Download(); // returns null if no download or filename if success if (success != null) { Console.WriteLine("PPR file downloaded sucessfuly"); Trace.TraceInformation("worker role: PPR file downloaded sucessfuly"); List <Record> recordList = dlf.ConvertFile(success); // returns list of record objects for sorting if (recordList != null || recordList.Count > 0) // list is null if has thrown exception or could be empty { CleanUpRecords cur = new CleanUpRecords(); List <AlteredRecord> alteredRecords = cur.CleanRecords(recordList); // clean records and return an altered record list AddToDatabase atb = new AddToDatabase(); atb.AddList(alteredRecords, dateTimeUpdatedTo); // send list of to be broken down into counties and added to database documents AlterUpdateDates(); // change the dates in the update document to the new dates } } }
//Add Groupbox Add button clicked private void addMasterListAddButton_Click(object sender, EventArgs e) { //Add Entry button pressed, gather info and add entry if(addMasterListNameTextbox.Text.Length > 0) { AddToDatabase database = new AddToDatabase(); sendValues = new MasterListValues(addMasterListNameTextbox.Text, commonMethod.GetCameraNumber(cameraAddMasterCombo.Text)); if (database.AddMasterList(sendValues)) { //Add entry success updateStatus.UpdateStatusBar("New Master Tape added to database", mainform); addMasterListNameTextbox.Clear(); cameraAddMasterCombo.SelectedIndex = 0; MakeGroupboxesInvisible(); PopulateMasterList(); } else { //Add Entry failure updateStatus.UpdateStatusBar("Entry was not added to database", mainform); } } }
//Edit Groupbox edit button pressed private void editMasterEditButton_Click(object sender, EventArgs e) { //Edit Entry button pressed, gather info and update entry //check to make sure something is entered in the textbox if(editNewNameMasterTextbox.Text.Length > 0) { AddToDatabase database = new AddToDatabase(); //Create MasterListValues of old info MasterListValues oldValues = new MasterListValues(sendValues.MasterArchive, sendValues.MasterMedia, sendValues.ID); //Create MasterListValues of old info MasterListValues newValues = new MasterListValues(editNewNameMasterTextbox.Text, commonMethod.GetCameraNumber(editCameraNewMasterDropdown.GetItemText(editCameraNewMasterDropdown.SelectedItem))); //Send to update method in AddToDatabase class & check if successful if(database.UpdateMasterList(oldValues, newValues)) { //update successful updateStatus.UpdateStatusBar("Update of Master Tape successful", mainform); //Clear items and close groupbox editNewNameMasterTextbox.Clear(); editCameraNewMasterDropdown.SelectedIndex = 0; MakeGroupboxesInvisible(); //Load new database info into listbox PopulateMasterList(); }else { //update failed updateStatus.UpdateStatusBar("Update Error", mainform); } } }
//Delete Groupbox Delete button clicked private void deleteMasterListDeleteButton_Click(object sender, EventArgs e) { //Delete button pressed, gather info and delete entry //Show message box to make sure user is to be deleted DialogResult deleteMessage = MessageBox.Show("Do you want to delete " + deleteMasterNameMasterListLabel.Text + "?", "Deletion Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //Check to see if user pressed yes or no if (deleteMessage == DialogResult.Yes) { //Yes Pressed, delete user from DB Debug.WriteLine("Yes Pressed for deletion"); AddToDatabase deleteDB = new AddToDatabase(); int _id = 0; foreach(MasterListValues item in masterList) { if (item.MasterArchive.Equals(deleteMasterNameMasterListLabel.Text)) { _id = item.ID; } } MasterListValues values = new MasterListValues(deleteMasterNameMasterListLabel.Text, commonMethod.GetCameraDropdownIndex(deleteCameraNameMasterListLabel.Text),_id); //Delete user from database if (deleteDB.DeleteMasterList(values)) { //deletion success updateStatus.UpdateStatusBar(deleteMasterNameMasterListLabel.Text + " deleted!", mainform); MakeGroupboxesInvisible("delete"); PopulateMasterList(); } else { updateStatus.UpdateStatusBar("There was an error deleting " + deleteMasterNameMasterListLabel.Text, mainform); MakeGroupboxesInvisible("delete"); } } else if (deleteMessage == DialogResult.No) { //No Pressed, nothing will be done } }
//Edit button pressed private void editTapeEditButton_Click(object sender, EventArgs e) { //check to see if project ID is a number if (commonMethod.StringIsANumber(editProjectIDTextbox.Text)) { AddToDatabase editDB = new AddToDatabase(); string projectNameEdit = ""; if (editProjectNameLabel.Text.Length > 0) { projectNameEdit = editProjectNameLabel.Text; } else { projectNameEdit = editTapeNameTextbox.Text; } //if there is text in tags textbox then add it on the end of the tag string if (editTagsTextbox.TextLength > 0 && !editTagList.Contains(editTagsTextbox.Text.ToLower().Replace(",", ""))) { editTagList.Add(editTagsTextbox.Text); } //Create new TapeDatabaseValues for edited entry TapeDatabaseValues newTapeValues = new TapeDatabaseValues( editTapeNameTextbox.Text, editTapeNumberUpDown.Value.ToString(), editProjectIDTextbox.Text, projectNameEdit, commonMethod.GetCameraNumber(editCameraDropdown.Text), String.Join(",", editTagList), commonMethod.ConvertDateFromDropdownForDB(editDateShotDate.Value), editTapeMasterListLabel.Text, editPersonDropdown.Text); //Check if user made a change if (CompareOldEditValues(newTapeValues)) { //Update entry and check to make sure it is updated if (editDB.UpdateTapeDatabase(newTapeValues, tapeValues)) { //Enrty Update Successful ClearEditControls(); tapeValues.Clear(); PopulateTapeList(); MakeBoxesVisible(); tapeListListView.Focus(); updateStatus.UpdateStatusBar("Values Updated in Database", mainform); } else { //Entry Update Unsuccessful updateStatus.UpdateStatusBar("There Was A Problem Updated Entry", mainform); } } else { //User Needs to change a value updateStatus.UpdateStatusBar("Must Change At Least One Value", mainform); } }else { //project ID was NOT a number updateStatus.UpdateStatusBar("Project ID must be a number", mainform); } }
//Delete Button Pressed private void deleteTapeDeleteButton_Click(object sender, EventArgs e) { //Delete button pressed, gather info and delete entry //Show message box to make sure user is to be deleted DialogResult deleteMessage = MessageBox.Show("Do you want to delete the entry " + tapeValues.ProjectId + ": "+ tapeValues.ProjectName + "?", "Deletion Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //Check to see if user pressed yes or no if (deleteMessage == DialogResult.Yes) { //Yes Pressed, delete user from DB Debug.WriteLine("Yes Pressed for deletion"); AddToDatabase deleteDB = new AddToDatabase(); if(tapeListListView.SelectedItems.Count == 1) { //Delete tape from database if (deleteDB.DeleteTapeDatabase(tapeValues)) { //deletion success tapeValues.Clear(); ClearDeleteLabels(); PopulateTapeList(); MakeBoxesVisible(); tapeListListView.Focus(); updateStatus.UpdateStatusBar("Entry deleted", mainform); } else { updateStatus.UpdateStatusBar("There was an error deleting entry", mainform); MakeBoxesVisible(); tapeListListView.Focus(); } } } else if (deleteMessage == DialogResult.No) { //No Pressed, nothing will be done } }
//Add Button pressed private void addTapeAddButton_Click(object sender, EventArgs e) { //check if project id is a number if (commonMethod.StringIsANumber(addProjectIDTextbox.Text)) { //check to make sure that all info is entered if (addProjectIDTextbox.Text.Length > 0 && addTapeNameTextbox.Text.Length > 0 && (addTagList.Count > 0 || addTagsTextbox.TextLength > 0) && addTapeNumUpDown.Value > 0 && addCameraComboBox.Text.Length > 0 && addTapePersonDropdown.Text.Length > 0) { //load tape values to add to database tapeValues.ProjectId = addProjectIDTextbox.Text; if (addTapeListProjectName.Text.Length > 0) { tapeValues.ProjectName = addTapeListProjectName.Text; } else { tapeValues.ProjectName = addTapeNameTextbox.Text; } tapeValues.TapeName = addTapeNameTextbox.Text; tapeValues.TapeNumber = addTapeNumUpDown.Value.ToString(); tapeValues.Camera = commonMethod.GetCameraNumber(addCameraComboBox.Text); //if there is text in tags textbox then add it on the end of the tag string if (addTagsTextbox.TextLength > 0 && !addTagList.Contains(addTagsTextbox.Text.ToLower().Replace(",", ""))) { addTagList.Add(addTagsTextbox.Text); } tapeValues.TapeTags = String.Join(",", addTagList); tapeValues.MasterArchive = addTapeMasterArchiveLabel.Text; tapeValues.DateShot = commonMethod.ConvertDateFromDropdownForDB(addDateDateTime.Value); tapeValues.PersonEntered = addTapePersonDropdown.Text; //Add to database and check to make sure it is added AddToDatabase addDB = new AddToDatabase(); if (addDB.AddTapeDatabase(tapeValues)) { //update status and clear all controls and variables updateStatus.UpdateStatusBar("Tape Added to Database", mainform); PopulateTapeList(); tapeValues.Clear(); ClearAddControls(); MakeBoxesVisible(); tapeListListView.Focus(); } } else { updateStatus.UpdateStatusBar("Please Fill Out All Fields", mainform); } }else { updateStatus.UpdateStatusBar("Project ID must be a number", mainform); } }
private void worker_DoWork(object sender, DoWorkEventArgs e) { AddToDatabase addToDatabase = new AddToDatabase(); for (int switchvar = 0; switchvar < 17; switchvar++) { if (worker.CancellationPending) { MessageBoxResult result = MessageBox.Show( "Do you want to cancel this task? Cancelling could cause issue with the database file", "Cancel Operation", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (result == MessageBoxResult.Yes) { e.Cancel = true; return; } } switch (switchvar) { case 0: addToDatabase.fetch_vn_basic(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 1: addToDatabase.fetch_vn_details(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 2: addToDatabase.fetch_vn_relations(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 3: addToDatabase.fetch_vn_stats(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 4: addToDatabase.fetch_vn_screens(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 5: addToDatabase.fetch_releases(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 6: addToDatabase.fetch_characters(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 7: addToDatabase.fetch_tags(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 8: addToDatabase.fetch_traits(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 9: addToDatabase.AddNovelData(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 10: addToDatabase.AddNovelCategory(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 11: addToDatabase.AddVnApi(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 12: addToDatabase.AddVnRelations(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 13: addToDatabase.AddVnTags(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 14: addToDatabase.AddReleaseApi(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 15: addToDatabase.AddCharacterApi(); (sender as BackgroundWorker).ReportProgress(switchvar); break; case 16: addToDatabase.AddCharacterTraits(); (sender as BackgroundWorker).ReportProgress(switchvar); break; } Thread.Sleep(220); } }
/// <summary> /// Add positions from datagrind into database. /// </summary> private void importDatagridToDatabaseButton(object sender, RoutedEventArgs e) { AddToDatabase.AddDatagridListWithAllDocuments(); }
/// <summary> /// Gets all tables from imported database and inserts the information into the default database /// </summary> /// <param name="file">The file.</param> /// <param name="mainForm">The main form.</param> public static void GetTableName(string file, TNG_Database.MainForm mainForm) { List<string> allTables = new List<string>(); Debug.WriteLine("Starting to import"); //new database filename string fileDatabase = "Data Source=" + file + ";Version=3;"; Debug.WriteLine(fileDatabase); //progressbar status for each table int everyTable = 0; int progress = 0; try { //command to get all tables in database const string GET_TABLES_QUERY = "select name from sqlite_master where type='table'"; SQLiteConnection connection = new SQLiteConnection(fileDatabase); connection.Open(); SQLiteCommand command = new SQLiteCommand(GET_TABLES_QUERY, connection); using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { Debug.WriteLine("import has tables"); while (reader.Read()) { if (TNGTables.Contains(reader.GetString(0))) { allTables.Add(reader.GetString(0)); } } } } //close connection connection.Close(); }catch(SQLiteException e) { MainForm.LogFile("SQLite Error: " + e.Message); Debug.WriteLine("SQLite Error: " + e.Message); } try { //check to see if there are any tables returned if (!allTables.Count.Equals(0)) { //set progressbar status to division on count of tables everyTable = 100 / allTables.Count; Debug.WriteLine("Table Number #: " + everyTable); AddToDatabase addDB = new AddToDatabase(); foreach (string table in allTables) { //connection for new database SQLiteConnection connect = new SQLiteConnection(fileDatabase); connect.Open(); SQLiteCommand command = new SQLiteCommand(connect); command.CommandText = "Select * from " + table; switch (table) { case "TapeDatabase": case "DeleteTapeDatabase": //create values object List<TapeDatabaseValues> tapeList = new List<TapeDatabaseValues>(); TapeDatabaseValues tapeValues = new TapeDatabaseValues(); //execute query using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { tapeValues.Clear(); tapeValues.ProjectId = reader["project_id"].ToString(); tapeValues.ProjectName = reader["project_name"].ToString(); tapeValues.TapeName = reader["tape_name"].ToString(); tapeValues.TapeNumber = reader["tape_number"].ToString(); tapeValues.Camera = Convert.ToInt32(reader["camera"]); tapeValues.TapeTags = reader["tape_tags"].ToString(); tapeValues.DateShot = reader["date_shot"].ToString(); tapeValues.MasterArchive = reader["master_archive"].ToString(); tapeValues.PersonEntered = reader["person_entered"].ToString(); //add values to list tapeList.Add(tapeValues); } } } //Close import connection connect.Close(); //iterate over values to add to database foreach (TapeDatabaseValues values in tapeList) { if (table == "TapeDatabase") { //add value to database addDB.AddTapeDatabase(values); } else if(table == "DeleteTapeDatabase") { //Open up new connection SQLiteConnection deleteConnect = new SQLiteConnection(database); deleteConnect.Open(); command.Connection = deleteConnect; command.CommandText = "select count(*) from DeleteTapeDatabase where lower(project_name) = @projectName and project_id = @projectID"; command.Parameters.Clear(); command.Parameters.AddWithValue("@projectID", values.ProjectId); command.Parameters.AddWithValue("@projectName", values.ProjectName.ToLower()); Int32 check = Convert.ToInt32(command.ExecuteScalar()); //Make sure that entry doesn't exist already if (check < 1) { //add value to deleted database //There is not an entry go ahead and insert new row command.CommandText = "insert into DeleteTapeDatabase (tape_name, tape_number, project_id, project_name, camera, tape_tags, date_shot, master_archive, person_entered) values (@tapeName, @tapeNumber, @projectID, @projectName, @camera, @tapeTags, @dateShot, @masterArchive, @personEntered)"; command.Parameters.Clear(); command.Parameters.AddWithValue("@tapeName", values.TapeName); command.Parameters.AddWithValue("@tapeNumber", values.TapeNumber); command.Parameters.AddWithValue("@projectID", values.ProjectId); command.Parameters.AddWithValue("@projectName", values.ProjectName); command.Parameters.AddWithValue("@camera", values.Camera); command.Parameters.AddWithValue("@tapeTags", values.TapeTags); command.Parameters.AddWithValue("@dateShot", values.DateShot); command.Parameters.AddWithValue("@masterArchive", values.MasterArchive); command.Parameters.AddWithValue("@personEntered", values.PersonEntered); command.ExecuteNonQuery(); } deleteConnect.Close(); } } UpdateProgess(everyTable, mainForm); progress += everyTable; break; case "Projects": case "DeleteProjects": //create values object List<ProjectValues> projectList = new List<ProjectValues>(); ProjectValues projectValues = new ProjectValues(); //execute query using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { projectValues.Clear(); projectValues.ProjectID = reader["project_id"].ToString(); projectValues.Projectname = reader["project_name"].ToString(); //add values to list projectList.Add(projectValues); } } } //Close import connection connect.Close(); //iterate over values to add to database foreach (ProjectValues values in projectList) { if (table == "Projects") { //add value to database addDB.AddProjects(values); } else if (table == "DeleteProjects") { //Open up new connection SQLiteConnection deleteConnect = new SQLiteConnection(database); deleteConnect.Open(); command.Connection = deleteConnect; command.CommandText = "select count(*) from DeleteProjects where lower(project_name) = @projectName and project_id = @projectID"; command.Parameters.Clear(); command.Parameters.AddWithValue("@projectID", values.ProjectID); command.Parameters.AddWithValue("@projectName", values.Projectname.ToLower()); Int32 check = Convert.ToInt32(command.ExecuteScalar()); //Make sure that entry doesn't exist already if (check < 1) { //add value to deleted database //There is not an entry go ahead and insert new row command.CommandText = "insert into DeleteProjects (project_id, project_name) values (@projectID, @projectName)"; command.Parameters.Clear(); command.Parameters.AddWithValue("@projectID", values.ProjectID); command.Parameters.AddWithValue("@projectName", values.Projectname); command.ExecuteNonQuery(); } deleteConnect.Close(); } } UpdateProgess(everyTable, mainForm); progress += everyTable; break; case "People": case "DeletePeople": //create values object List<PeopleValues> peopleList = new List<PeopleValues>(); PeopleValues peopleValues = new PeopleValues(); //execute query using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { peopleValues.Clear(); peopleValues.PersonName = reader["person_name"].ToString(); //add values to list peopleList.Add(peopleValues); } } } //Close import connection connect.Close(); //iterate over values to add to database foreach (PeopleValues values in peopleList) { if (table == "People") { //add value to database addDB.AddPerson(values); } else if (table == "DeletePeople") { //Open up new connection SQLiteConnection deleteConnect = new SQLiteConnection(database); deleteConnect.Open(); command.Connection = deleteConnect; command.CommandText = "select count(*) from DeletePeople where lower(person_name) = @personName"; command.Parameters.Clear(); command.Parameters.AddWithValue("@personName", values.PersonName.ToLower()); Int32 check = Convert.ToInt32(command.ExecuteScalar()); //Make sure that entry doesn't exist already if (check < 1) { //add value to deleted database //There is not an entry go ahead and insert new row command.CommandText = "insert into DeletePeole (person_name) values (@personName)"; command.Parameters.Clear(); command.Parameters.AddWithValue("@personName", values.PersonName); command.ExecuteNonQuery(); } deleteConnect.Close(); } } UpdateProgess(everyTable, mainForm); progress += everyTable; break; case "MasterList": case "DeleteMasterList": //create values object List<MasterListValues> masterTapeList = new List<MasterListValues>(); MasterListValues masterTapeValues = new MasterListValues(); //execute query using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { masterTapeValues.Clear(); masterTapeValues.MasterArchive = reader["master_archive"].ToString(); masterTapeValues.MasterMedia = Convert.ToInt32(reader["master_media"]); //add values to list masterTapeList.Add(masterTapeValues); } } } //Close import connection connect.Close(); //iterate over values to add to database foreach (MasterListValues values in masterTapeList) { if (table == "MasterList") { //add value to database addDB.AddMasterList(values); } else if (table == "DeleteMasterList") { //Open up new connection SQLiteConnection deleteConnect = new SQLiteConnection(database); deleteConnect.Open(); command.Connection = deleteConnect; command.CommandText = "select count(*) from DeleteMasterList where lower(master_archive) = @masterArchive and master_media = @masterMedia"; command.Parameters.Clear(); command.Parameters.AddWithValue("@masterArchive", values.MasterArchive.ToLower()); command.Parameters.AddWithValue("@masterMedia", values.MasterMedia); Int32 check = Convert.ToInt32(command.ExecuteScalar()); //Make sure that entry doesn't exist already if (check < 1) { //add value to deleted database //There is not an entry go ahead and insert new row command.CommandText = "insert into DeleteMasterList (master_archive, master_media) values (@masterArchive, @masterMedia)"; command.Parameters.Clear(); command.Parameters.AddWithValue("@masterArchive", values.MasterArchive); command.Parameters.AddWithValue("@masterMedia", values.MasterMedia); command.ExecuteNonQuery(); } deleteConnect.Close(); } } UpdateProgess(everyTable, mainForm); progress += everyTable; break; case "MasterArchiveVideos": case "DeleteMasterArchiveVideos": //create values object List<MasterArchiveVideoValues> masterArchiveVideoList = new List<MasterArchiveVideoValues>(); MasterArchiveVideoValues MasterArchiveVideoValues = new MasterArchiveVideoValues(); //execute query using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { MasterArchiveVideoValues.Clear(); MasterArchiveVideoValues.ProjectId = reader["project_id"].ToString(); MasterArchiveVideoValues.VideoName = reader["video_name"].ToString(); MasterArchiveVideoValues.MasterTape = reader["master_tape"].ToString(); MasterArchiveVideoValues.ClipNumber = reader["clip_number"].ToString(); //add values to list masterArchiveVideoList.Add(MasterArchiveVideoValues); } } } //Close import connection connect.Close(); //iterate over values to add to database foreach (MasterArchiveVideoValues values in masterArchiveVideoList) { if (table == "MasterArchiveVideos") { //add value to database addDB.AddMasterArchiveVideo(values); } else if (table == "DeleteMasterArchiveVideos") { //Open up new connection SQLiteConnection deleteConnect = new SQLiteConnection(database); deleteConnect.Open(); command.Connection = deleteConnect; command.CommandText = "select count(*) from DeleteMasterArchiveVideos where project_id = @projectID and video_name = @videoName and clip_number = @clipNumber and master_tape = @masterTape"; command.Parameters.Clear(); command.Parameters.AddWithValue("@projectID", values.ProjectId); command.Parameters.AddWithValue("@videoName", values.VideoName); command.Parameters.AddWithValue("@masterTape", values.MasterTape); command.Parameters.AddWithValue("@clipNumber", values.ClipNumber); Int32 check = Convert.ToInt32(command.ExecuteScalar()); //Make sure that entry doesn't exist already if (check < 1) { //add value to deleted database //There is not an entry go ahead and insert new row command.CommandText = "insert into DeleteMasterArchiveVideos (project_id, video_name, master_tape, clip_number) values (@projectID, @videoName, @masterTape, @clipNumber)"; command.Parameters.Clear(); command.Parameters.AddWithValue("@projectID", values.ProjectId); command.Parameters.AddWithValue("@videoName", values.VideoName); command.Parameters.AddWithValue("@masterTape", values.MasterTape); command.Parameters.AddWithValue("@clipNumber", values.ClipNumber); command.ExecuteNonQuery(); } deleteConnect.Close(); } } UpdateProgess(everyTable, mainForm); progress += everyTable; break; case "ComputerInfo": //create values object List<ComputerInfoValues> computerInfoList = new List<ComputerInfoValues>(); ComputerInfoValues computerInfoValues = new ComputerInfoValues(); //execute query using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { computerInfoValues.Clear(); computerInfoValues.UniqueHash = reader["computer_hash"].ToString(); computerInfoValues.ComputerName = reader["computer_name"].ToString(); computerInfoValues.ComputerUser = reader["computer_user"].ToString(); //add values to list computerInfoList.Add(computerInfoValues); } } } //Close import connection connect.Close(); //iterate over values to add to database foreach (ComputerInfoValues values in computerInfoList) { //add value to database addDB.AddComputerInfo(values); } UpdateProgess(everyTable, mainForm); progress += everyTable; break; } } } }catch(SQLiteException e) { MainForm.LogFile("SQLite Error: " + e.Message); Debug.WriteLine("SQLite Table Error: " + e.Message); } if((100 - progress) > 0) { UpdateProgess((100-progress), mainForm); } }