Did you try this code? It uses Web Pages version of the code to select a record from the database.
Works fine in .cshtml files of ASP.NET
var db = Database.Open("database_name");
var record = db.Query("SELECT * FROM table_name WHERE column_name = @0", parameter);
Now wherever the value would be true, the result would be returned. A real example of this case is,
WHERE UserId = @0", 20
, to select the profile of user with UserId 20.