public void ExecuteScalarWithPrepare_Test() { var sample = new Dictionary <int, string>() { { 7369, "SMITH" }, { 7499, "ALLEN" } }; using (var cmd = new DatabaseCommand(_connection)) { cmd.Log = Console.WriteLine; cmd.CommandText = @"SELECT ENAME FROM EMP WHERE EMPNO = @EmpNo "; cmd.AddParameter("@EMPNO", 0, System.Data.DbType.Int32); cmd.Prepare(); foreach (var item in sample) { cmd.Parameters["@EMPNO"].Value = item.Key; var ename = cmd.ExecuteScalar <string>(); Assert.AreEqual(item.Value, ename); } } }