Sunflower joining problem
For those of you who are decent with subsonic!
TblNewsCollection col =
new Select().From(Tables.TblNews)
.InnerJoin(Tables.TblContent)
.Paged(currentPage, pageSize)
.OrderDesc(TblContent.Columns.PubDate)
.ExecuteAsCollection<TblNewsCollection>();
The above works, no problem, but when I try to add a where clause
TblNewsCollection col =
new Select().From(Tables.TblNews)
.InnerJoin(Tables.TblContent)
.Where(TblContent.Columns.UserFK)
.IsEqualTo(guidUserFK)
.Paged(currentPage, pageSize)
.OrderDesc(TblContent.Columns.PubDate)
.ExecuteAsCollection<TblNewsCollection>();
I get this message
System.InvalidCastException: Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
System.InvalidCastException: Failed to convert parameter value from a Guid to a String.
I've tried this from other fields, like the bit field in the database, where it says it can't convert from bool to bit!
It seems like it is only a matter of where the statements after merging
0
source to share
2 answers
Northwind.CustomerCollection customersByCategory = new Select()
.From(Northwind.Customer.Schema)
.InnerJoin(Northwind.Order.Schema)
.InnerJoin(Northwind.OrderDetail.OrderIDColumn, Northwind.Order.OrderIDColumn)
.InnerJoin(Northwind.Product.ProductIDColumn, Northwind.OrderDetail.ProductIDColumn)
.Where("CategoryID").IsEqualTo(5)
.ExecuteAsCollection<Northwind.CustomerCollection>();
Here's an example that supposedly works. If it can help me please!
0
source to share