/*********** - functions - ***************/ public void UpdateDB(string URL) { try { bool blSuccess = PingTest(URL); if (blSuccess == true) { SQLiteConnection objLocalConnection = CreateSQLite_Connection(); if (strError == "") { SQLiteDataReader objReader = queryLocalDB(objLocalConnection); if (objReader.HasRows == true) { MySqlConnection objRemoteConnection = CreateMySQL_Connection("htcCloudDB.net"); while (objReader.Read()) { if (strError == "") { //Updating remote db - * todo - do some sort of error checking to make sure query works int intUserID = Convert.ToInt16(objReader["Person_ID"]); DateTime dtTime = Convert.ToDateTime(objReader["Time"]); int intID = Convert.ToInt16(objReader["ID"]); MySqlDataReader objRemoteReader = UpdateRemoteDB(objRemoteConnection, intUserID, dtTime, intID); if (objRemoteReader.HasRows == true) { while (objRemoteReader.Read()) { string strStatus = objRemoteReader["Status"].ToString(); if (strStatus != "Double-Swipe") { intID = Convert.ToInt16(objReader["ID"]); updateLocalDB_Added(objLocalConnection, objRemoteReader, intID); } } objRemoteReader.Close(); } } } } } } } catch (System.Exception e) { clsLog objLog = new clsLog(); strError = e.Message.ToString(); objLog.writeToLog(System.DateTime.Now.ToString() + " - " + e.Message.ToString()); } }
static void Main(string[] args) { objDatabase_URDB clsDB = new objDatabase_URDB(); try { clsDB.UpdateDB("htcCloudDB.net"); if (clsDB.Error == "") Console.WriteLine("Success - all rows were updated"); else Console.WriteLine(clsDB.Error.ToString()); } catch (System.Exception e) { clsLog objLog = new clsLog(); objLog.writeToLog(e.Message); } }