コード例 #1
0
        public void NamedParametersReuseTest()
        {
            string sql = "select * from test where int_field >= @lang and int_field <= @lang";

            BdpCommand command = new BdpCommand(sql, this.Connection);

            command.Parameters.Add("@lang", BdpType.Int32).Value = 10;

            BdpDataReader reader = command.ExecuteReader();

            int count    = 0;
            int intValue = 0;

            while (reader.Read())
            {
                if (count == 0)
                {
                    intValue = reader.GetInt32(0);
                }
                count++;
            }

            Assert.AreEqual(1, count, "Invalid number of records fetched.");
            Assert.AreEqual(10, intValue, "Invalid record fetched.");

            reader.Close();
            command.Close();
        }