private void btnInsetTo_Click(object sender, RoutedEventArgs e) { if (newDataScrambled == null) { MessageBox.Show("Please RUN -> [Run (Bring Data A)] ... "); return; } if (newDataScrambled.dsResult == null) { MessageBox.Show(" Result is NULL ... DataSet MUST has at least one Table and one Row! "); return; } listSB = new List <StringBuilder>(); OleDbDataBase db = new OleDbDataBase(); listSB = db.BuildDB2DeleteSQL(newDataScrambled.dsResult); foreach (DataTable dt in newDataScrambled.dsResult.Tables) { listSB.AddRange(db.BuildDB2InsertSQL(dt)); } if (newRunInsert != null) { newRunInsert.Close(); } newRunInsert = new RunInsert(); newRunInsert.strConnectionStringTo = strConnectionStringTo; newRunInsert.listSB = listSB; newRunInsert.Show(); }
private List <string> findTablesName(StringBuilder sbRun) { List <string> listTablesName = new List <string>(); OleDbDataBase db = new OleDbDataBase(); string strNotCommented = ""; foreach (string str in sbRun.ToString().Split('\n')) { int intFirstComment = str.IndexOf("--"); if (intFirstComment >= 0) { strNotCommented += str.Substring(0, intFirstComment) + Environment.NewLine; } else { strNotCommented += str + Environment.NewLine; } } string[] strSQL = strNotCommented.Split(';'); foreach (string str in strSQL) { string strName = db.extractTableName(str); if (strName != "" && !listTablesName.Exists(x => x == strName)) { listTablesName.Add(strName); } } return(listTablesName); }
private void MainWindow_Unloaded(object sender, RoutedEventArgs e) { try { // db.connToDB.Close(); db = null; } catch { } }
private void btnTestB_Click(object sender, RoutedEventArgs e) { try { OleDbDataBase db = new OleDbDataBase(); if (db.blnTestConnection(txtConnB.Text) == false) { MessageBox.Show("Wrong Connection String [B] ..."); return; } blnTestedB = true; btnTestB.Background = new SolidColorBrush(Colors.Green); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }