I am able to retrieve database values and insert database values, but I can't figure out what the Update() syntax should be with a where statement.
Environment -> ASP.Net, C#
Settings.ttinclude
const string Namespace = "subsonic_db.Data";
const string ConnectionStringName = "subsonic_dbConnectionString";
//This is the nam...
Trying to map MySQL database schema using SubSonic 3, I get "Running transformation: System.InvalidOperationException: Sequence contains more than one matching element..." on all tables with a multiple-column Primary Key. Indeed, from the following MySQL.ttinclude code, it appears that you get only one PK column per table.
i...
hello
I am using Active record pattern of SubSonic 3 version. My requirement is to get 3 random rows from the Table. After some googling I found out that I can use NewID function in SQL but I dont know to get the Randow rows using sub sonic
Thanks
...
Hi,
I am using SubSonic 3.0.0.4 with the ActiveRecord T4 Templates.
I am hooking into OnSaving and getting a list of dirty columns that are about to be saved.
What I cannot figure out is how to get each of the dirty columns values. Can someone assist?
TIA - Mike
...
Hi,
How to I execute a Stored Procedure with SimpleRepository and get a Typed List as a answer?
I'm using SubSonic 3.
Thanks.
...
Say I have a stored procedure that returns dataSet from 2 different tables. Example:
SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer
FROM Customers LEFT JOIN Sales
ON Customers.CustomerID = Sales.CustomerID
GROUP BY Customers.FirstName, Customers.LastName
Is there any way to get a strongly ty...
Hi All,
I have the following simple LINQ query (SubSonic 3.0.0.4 and ActiveRecord T4 templates).
from item in PermissionsInRole.All()
where item.RoleID == roleID
select item
When I iterate through the elements in the list after executing the query, IsNew = true for all of them, so if I make a change to an item and call.Save() it tri...
We use SubSonic as an ORM of sorts(really more of a query-helper). For one reason or another, we have a bit of a dynamic schema and as such certain tables have generated column names and such. Well, this has been all fine and dandy until now. Now, our production generated columns don't match up with our development generated columns. The...
Hi all,
I'm new to SubSonic and reasonably new to LINQ as well, so I'm just trying to put a little app together.
I've got the templates all sorted and running okay, but I've run into a bit of trouble with this LINQ statement (simplified slightly, the real statement has some other joins but they don't affect this particular problem so I'...
I have the following code:
if (collection["Filter"] == "2") {
presentations = presentations.Where(x => x.Speaker.FirstName.StartsWith("B")).
OrderBy(x => x.Speaker.FirstName);
}
this generates the following sql:
SELECT [t0].[Description], [t0].[EventId], [t0].[Id], [t0].[PresentedOn],
[t0].[Slug], [t0].[SpeakerId], ...
I have a relatively simple ASP.net MVC 2 app that is using SubSonic. Everything seems to work well locally, but when I deployed it to WinHost, I keep getting an exception like so:
System.TypeAccessException: Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Data.Common.DbDataReader)' to access...
I have been told that it's more than likely my database that is setup wrong causing the problems so below are my tables with key fields and queries.
CREATE TABLE Presentations (
Id INT NOT NULL IDENTITY(1, 1),
SpeakerId INT NOT NULL,
CONSTRAINT PK_Presentations PRIMARY KEY (Id),
CONSTRAINT FK_Presentations_Speaker FOREI...
I want to update multiple rows in my SQL database using subsonic but I can't figure out how to do it. What's the easiest way of doing it?
It would be something like this in sql : UPDATE table SET rowItem = 4 WHERE row_item = 3
...
Hello, I am using the T4 templates of SubSonic 3.0 to generate classes and such for me. Well in my database I have a Zipcode table with these columns
ZipCode_rid
Zipcode (the actual zipcode in number format)
State
etc
Well, when the T4 templates run, instead of having a column like Zipcode.Zipcode I get Zipcode.ZipcodeX. Then, when t...
I am trying to write T4 template to create wrapper classes for classes created by SubSonic 3 (implementing IActiveRecord). But when I compile my template I get following error:
Compiling transformation: Metadata file 'SubSonic.Core' could not be found
I'm including SubSonic.Core in my settings file. <#@ assembly name="SubSonic.Core" #...
Lets say I have a many-to-many relationship:
Group table
User table
group_user table which is a many to many table
Given the group name I would like to find all the users that belong to this group.
How can I do this with subsonic 3.0?
IQueryable<group_user> groupUser= group_user.All();
Is it possible from groupUser to get all use...
Hello, I'm creating a simple query with aggregates. The example is:
string query = new SubSonic.Query.Select(
SubSonic.Query.Aggregate.GroupBy("ProductID", "ID"),
SubSonic.Query.Aggregate.Max("Price", "MaxPrice")
).From("Orders").ToString();
The Sql Result is:
SELECT ProductID AS ID, MAX(Price) AS MaxPrice
FROM [Orders...
I'm new to Linq and SQL terminology - can someone tell me why this isn't working (syntax is not right - I can't compare u.UserID int with an Enumerable)
var projectUsers = from u in SimpleRepository.All<User>()
where u.UserID == (from i in SimpleRepository.All<ProjectUser>()
where...
The TOP keyword in the generated SQL wraps the number in brackets (I persume for SQL compact support), however this errors on my SQL 2000 server as it doesn't expect the brackets.
Example C# Code:
var doc = Logic.Document.All().FirstOrDefault(d=> d.Guid == Request.QueryString["guid"]);
Produces the following SQL error:
Line 1: In...
i created a datalayer using subsonic. however when i am selecting my data, i get the following exception.
System.ArgumentException was unhandled
Message="Object of type 'System.Boolean' cannot be converted to type 'System.SByte'."
Source="mscorlib"
StackTrace:
at System.RuntimeType.CheckValue(Object value, Binder binder...