public DataTable ViewAllChat(ChatBoxPageObject obj) { global.OpenConnection(obj.connectionString); global.startTransaction(); Sql = "SELECT \"Group2DB\".\"Account\".\"Username\",\"Group2DB\".\"ChatBox\".\"Chat\",\"Group2DB\".\"ChatBox\".\"DateTimePosted\"" + "FROM\"Group2DB\".\"ChatBox\"INNER JOIN \"Group2DB\".\"Account\" ON \"Group2DB\".\"ChatBox\".\"AccountID\" = \"Group2DB\".\"Account\".\"AccountID\""; return(global.Datasource(Sql)); }
public void submitChat(ChatBoxPageObject obj) { global.OpenConnection(obj.connectionString); global.startTransaction(); try { string str = "CURRENT_TIMESTAMP"; string sql = "INSERT INTO \"Group2DB\".\"ChatBox\" (\"AccountID\", \"Chat\", \"DateTimePosted\") VALUES ('" + obj.accountID + "', '" + obj.txtChat + "'," + str + ") "; global.Datasource(sql); global.commitQuery(); global.closeTransaction(); } catch (Exception e) { global.closeTransaction(); MessageBox.Show(e.Message + "Cannot Submit This Time"); } }