예제 #1
0
 public MessageCollection()
 {
     Content = new List<WebMessage>();
     DatabaseConnector dbc = new DatabaseConnector();
     var result = dbc.send("select * from Messages");
     foreach(String[] s in result)
     {
         Content.Add(new WebMessage { DateSent = DateTime.Parse(s[0]), Message = s[1] });
     }
 }
예제 #2
0
 static void Main(string[] args)
 {
     Console.Write("Enter message to post (or /c to cancel): ");
     String SQLInput = Console.ReadLine();
     if (SQLInput.ToLower() != "/c")
     {
         //Create new connection to database
         DatabaseConnector dbc = new DatabaseConnector();
         //Send request to database
         var sending = dbc.send("INSERT INTO Messages (Message) VALUES ('" + SQLInput + "');");
         Console.WriteLine("Message sent: " + SQLInput);
         Console.ReadKey();
         //INSERT INTO Messages (Message) VALUES ('HELLO')
     }
 }