Ejemplo n.º 1
0
        public void GetSequenceTest()
        {
            long id;

            using (iDB2Connection conn = new iDB2Connection(DB2Helper.ConnectionString))
            {
                id = DB2Helper.GetSequence(conn, "USER");
            }
            Assert.AreNotEqual(id, 0);
        }
Ejemplo n.º 2
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);
            }
        }