1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
| if (global_string.AufgabeSender == "ribbonButton_AufgabeBearbeiten_Click") { global_string.SqlCommandText = "UPDATE Aufgabe SET Aufgabe_Text = '" + ExtRichTextBox_Aufgabenbeschreibung.Rtf + "', Änderungsdatum = GetDate() WHERE ID_Aufgabe = '" + ID_Aufgabe + "'"; proc_write_to_database(global_string.ConnectionString, global_string.SqlCommandText); }
if (global_string.AufgabeSender == "ribbonButton_NeueAufgabe_MultipleChoice_Click") { global_string.SqlCommandText = "INSERT INTO Aufgabe (Gültigkeit, ID_Aufgabe, ID_Fach, ID_Schule, Aufgabe_Text, Aufgabentypus, Phase, Erstellungsdatum, Änderungsdatum) VALUES ('true','" + New_ID_Aufgabe + "','" + ID_Fach + "','" + ID_Schule + "','" + ExtRichTextBox_Aufgabenbeschreibung.Rtf + "','1','1',GetDate(),GetDate())"; proc_write_to_database(global_string.ConnectionString, global_string.SqlCommandText); }
private void proc_write_to_database(string string_ConnectionString, string string_SqlCommandText) { SqlCeConnection obj_SqlCeConnection = null; try { obj_SqlCeConnection = new SqlCeConnection(string_ConnectionString); obj_SqlCeConnection.Open(); SqlCeCommand obj_SqlCeCommand = obj_SqlCeConnection.CreateCommand(); obj_SqlCeCommand.CommandText = string_SqlCommandText; obj_SqlCeCommand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { obj_SqlCeConnection.Close(); } |