public void ToStringTest()
        {
            //
            // Thanks for Marting Baulig for these (DateTimeTest.cs)
            //

            SqlDateTime t1 = new SqlDateTime(2002, 2, 25, 5, 25, 13);
            SqlDateTime t2 = new SqlDateTime(2002, 2, 25, 15, 25, 13);

            // Standard patterns
            Assert.AreEqual("2/25/2002 5:25:13 AM", t1.ToString(), "L01");
            Assert.AreEqual((SqlString)"2/25/2002 5:25:13 AM", t1.ToSqlString(), "L02");
        }
Exemple #2
0
        static void FillRoomHistory()
        {
            Console.WriteLine("Filling Room Histories");

            List <int> usedstunum = new List <int>();
            SqlCommand cmd = new SqlCommand("", sql);
            String     RoomID, studentid, dateEntered, dateLeft;
            Random     r = new Random();

            for (int i = 0; i < 160; i++)
            {//roomid, studentid, dateEntered, dateLeft
                int studentNumber = r.Next(0, NUM_USER);
                while (studentNumber % 100 == 0 || studentNumber % 75 == 0 || usedstunum.Contains(studentNumber))
                {
                    studentNumber = r.Next(0, NUM_USER);
                }
                SqlDateTime entered = new SqlDateTime(2017, 9, 2);
                SqlDateTime left    = new SqlDateTime(2018, 5, 19);
                usedstunum.Add(studentNumber);
                cmd.CommandText = "INSERT INTO RoomHistory VALUES('" + i.ToString() + "','" + studentNumber.ToString() + "','" + entered.ToSqlString().ToString() + "','" + left.ToSqlString().ToString() + "')";
                cmd.ExecuteNonQuery();
            }
        }