Take the 2-minute tour ×

I'm trying to use SubSonic 3.0 with SQLite 3 in ASP.NET MVC. After initial pains of setting it up I am finally able to retrieve data from my single (so far) table database, however I never get a value for the Testimonial column. I tried renaming it to something like TestimonialText, I tried changing its data type to VARCHAR, NVARCHAR with different sizes and w/o an explicit size and even TEXT. Nothing works. I can query the database (using SQLite Administrator) and see the results - both in the grid and with manually written queries. I'm totally cluless as to what's happening. Here's some code:


CREATE TABLE [Testimonials] (
[Referral] NVARCHAR(30)  NOT NULL,
[Role] NVARCHAR(20)  NULL,
[Company] NVARCHAR(100)  NOT NULL,
[Url] VARCHAR(255)  NULL,
[Testimonial] NVARCHAR(500)  NOT NULL

Controller action

public ActionResult Index()
    // Get all testimonials.
    var testimonials = Testimonial.All();

    // Pick a random one.
    var count = testimonials.Count();
    var rnd = new Random().Next(count);
    var testimonial = testimonials.Skip(rnd).Take(1).Single();
    ViewData["Testimonial"] = testimonial;

    return View();


<%= Html.Encode(Model.TestimonialX) %><br />
<%= Html.Encode(Model.Referral + ", " + Model.Role) %><br />
<a href="<%= Model.Url %>"><%= Html.Encode(Model.Company) %></a>

All fields display their proper values, except TestimonialX, which returns NULL. WHY?!

share|improve this question
Why is it named TestimonialX in your View, but Testimonial elsewhere ? –  nos Jul 27 '09 at 14:02
SubSonic does that, I guess it happens when you have a column which is named the same as the table. That is also why I tried with TestimonialText, but it didn't help so I went back to Testimonial. –  Pawel Krakowiak Jul 27 '09 at 14:14

1 Answer 1

up vote 2 down vote accepted

The problem is that you have a column with the same name as the table and our Linq translator doesn't like it (something I'll be trying to fix in the coming weeks). If you rename this column (which is good practice anyway) it will work.

share|improve this answer
Thanks. I tried changing the name before, however I did not notice an error in the SQLite Administrator and thought that SubSonic did not do its job. That definitely helps! –  Pawel Krakowiak Jul 29 '09 at 7:14

Your Answer


