예제 #1
0
        public static void Add(int projectId, string question)
        {
            con = new Connections();
            string queryStr = "INSERT INTO [dbo].[Question] " +
                              "([Question], [ProjectId])" +
                              "VALUES (N'" + question + "', " + projectId + ")";

            con.ExecuteScalar(queryStr);
            con.CloseConnection();
        }
예제 #2
0
        public static void Add(int questionId, string answer, bool status)
        {
            con = new Connections();
            string queryStr = "INSERT INTO [dbo].[Answer] " +
                              "([Answer], [QuestionId], [Status])" +
                              "VALUES (N'" + answer + "', " + questionId + ", " + status + ")";

            con.ExecuteScalar(queryStr);
            con.CloseConnection();
        }
예제 #3
0
        public static void Add(string name, DateTime createdAt, int createdBy, DateTime startDate, DateTime endDate)
        {
            con = new Connections();
            string queryStr = "INSERT INTO [dbo].[Project] " +
                              "(ProjectCode, Name, CreatedAt, CreatedBy, StartDate, EndDate)" +
                              "VALUES ('PJ-' + CONVERT(VARCHAR, (SELECT IDENT_CURRENT('Project') AS INDENTITY)) + '" + createdAt.Day.ToString() + "', N'" + name + "', CONVERT(datetime, '" + createdAt + "', 103), " + createdBy + ", CONVERT(datetime, '" + startDate + "', 103), CONVERT(datetime, '" + endDate + "', 103))";

            con.ExecuteScalar(queryStr);
            con.CloseConnection();
        }