Hi guys
  This really has me stumped.

I've got a demo application that has this table in a SQL 2000 database.


CREATE TABLE [dbo].[Fruit](
    [id_fruit] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](255) NULL
) ON [PRIMARY]

I run this code against it.

  public IFruit GetFruitByName(IDbTransaction transaction, string name)
        {
            string sql = "select top 1 * from fruit where name = @name";
            List<IDbDataParameter> parameters = new
List<IDbDataParameter>();
            parameters.Add(Database.CreateParameter("@name", name));
            FruitBuilder builder = new FruitBuilder();
            using (IDataReader reader = Database.ExecuteReader(transaction,
sql, CommandType.Text, parameters, CommandBehavior.SingleRow))
            {
                IFruit fruit = builder.BuildOne(reader);
                return fruit;
            }
        }







Davy,


"Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live."
- Martin Golding

Reply via email to