Ejemplo n.º 1
0
        public void delete(string username)
        {
            string sql = "DELETE FROM \"USER\" WHERE USERNAME=@USERNAME";

            using (iDB2Connection conn = new iDB2Connection(DB2Helper.ConnectionString))
            {
                conn.Open();
                iDB2Parameter[] parms = new iDB2Parameter[] {
                    new iDB2Parameter("@USERNAME", username)
                };
                DB2Helper.ExecuteNonQuery(conn, CommandType.Text, sql, parms);
            }
        }
Ejemplo n.º 2
0
        public void update(User user)
        {
            string sql = "UPDATE \"USER\" SET PASSWORD=@PASSWORD WHERE USERNAME=@USERNAME";

            using (iDB2Connection conn = new iDB2Connection(DB2Helper.ConnectionString))
            {
                conn.Open();
                iDB2Parameter[] parms = new iDB2Parameter[] {
                    new iDB2Parameter("@PASSWORD", user.password),
                    new iDB2Parameter("@USERNAME", user.username)
                };
                DB2Helper.ExecuteNonQuery(conn, CommandType.Text, sql, parms);
            }
        }
Ejemplo n.º 3
0
        public void create(User user)
        {
            string sql = "INSERT INTO \"USER\"(USER_NO,USERNAME,PASSWORD) VALUES(@USER_NO,@USERNAME,@PASSWORD)";

            using (iDB2Connection conn = new iDB2Connection(DB2Helper.ConnectionString))
            {
                conn.Open();
                long            userNo = DB2Helper.GetSequence(conn, "USER");
                iDB2Parameter[] parms  = new iDB2Parameter[] {
                    new iDB2Parameter("@USER_NO", userNo),
                    new iDB2Parameter("@USERNAME", user.username),
                    new iDB2Parameter("@PASSWORD", user.password)
                };
                DB2Helper.ExecuteNonQuery(conn, CommandType.Text, sql, parms);
            }
        }