I have a table that contains procedure codes among other data (let's call it "MyData"). I have another table that contains valid procedure codes, their descriptions, and the dates on which those codes are valid. Every time I want to report on MyData and include the procedure description, I have to do a lookup similar to this:
From m in ...
Hey Everyone --
If I want to compile my LINQ->SQL classes into a DLL to provide to my developers, how can I make it so that they can still hook into the various entity partial methods (OnValidate, for example)? I know that you cannot implement partial methods on a compiled assembly, but any suggestions on how I can extract this behavio...
I am trying to update some object properties by calling UpdateModel(myObject, new[] { "stringprop1", "stringprop2", "intprop"}).
This is failing for an unknown reason. Several string properties are updating successfully. When I try to update an int property it fails. The new int value is being sent from an html select list on the view.
...
I am trying to programmatically drop a column in a table inside of an access database and found myself unable to do so! Is it at all possible? it makes me think that i don't have any clear idea of things linq to sql can't do.
Any ideas?
...
I'm having great trouble in converting the following SQL to LINQ to SQL, any one able to help out?
SELECT dbo.ExpensesGroup.ExpenseGroupId, dbo.ExpensesGroup.Title, SUM(dbo.Expenses.Amount) AS TotalAmount, MAX(dbo.Expenses.DateLastTickled)
AS LastTickledDate, MAX(dbo.ExpensesGroup.DateTime) AS Date, Username
F...
I have this SQL query
select case when AllowanceId is null then 2 else AllowanceId end as AllowanceId
, d.descen as domdescen
, t.descen as typdescen
, case when qty is null then 0 else qty end as qty
, u.descen as unidescen
from (select t.allowancetypeid, d.allowancedomainid
from allowancedomain as d, allowancetype as t
...
Please offer advice if you can...
I've based my project on Linq-To-SQL, and the (almost) finished application has very poor performance. I've fired up the SQL Profiler many times to optimize the queries with LoadOptions to reduce the number of round-trips to the database server, but at the end of the day, my conundurum is weaved into th...
I have a query with single result. The result is an anonymouse type. How can I use access the type so I don't have to use query.Single() every time?
This is my query:
var result = from row in db.Table
select new { CustomName = row.RowName };
This is how I use it right now:
string name = result.Single().CustomName;
Of course my re...
this doesn't feel right
Private Sub drop_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles iqty.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim row As allowanceQtyQuery = CType(e.Item.DataItem, allowanc...
I'm trying to move the following query to Linq-to-sql, is it possible?
select * from (
Select top (@Percent) percent with ties *
from(
Select distinct
LoanNumber as LoanNo
From CHE
Left Join RecordingInfo as Rec
On CHE.LoanNumber = Rec.LoanNo
Where Channel = 'LINX'
and CHE.Doc in ('MTG','MOD')
and Rec.LoanNo is null
and L...
Hi,
I've got a gridview with a list of categories. In the database (MSSQL2008), the category table has a SortOrder(INT) NULL field.
Currently categories are retrieved using:
Galleries.DataSource = From G In DB.GalleryCategories Order By G.SortOrder, G.Name
Now, what I need to be able to do is add "Move Up" and "Move Down" buttons to...
Hi All,
Yes, this is my fourth day in a row to ask a question about abstracts, sorry, I'll try and go answer some questions about SQLServer to return the favor to the community. Anyway...
How can I project the results of a Linq query into a abstract base class collection? Here is my my method from my RecruiterBase abstract class (there ...
My understanding is that the LinqToSql pseudolanguage describes a set using a syntax very similar to SQL and this will allow you to efficiently update a property on a collection of objects:
from b in BugsCollection where b.status = 'closed' set b.status = 'open'
This would update the underlying database using just one SQL statement.
...
I'm trying to rewrite some old SQL into LINQ to SQL. I have a sproc with a GROUP BY WITH ROLLUP but I'm not sure what the LINQ equivalent would be. LINQ has a GroupBy but it doesn't look like it supports ROLLUP.
A simplified example of the results I'm trying to get would be something like this:
City | ServicePlan | NumberOfCusto...
I am using LINQ to SQL with Sql Server Compact Edition 3.5 and VS2008.
I have a very simple table (Tokens) with a uniqueidentifier primary key (TokenID) and two other nullable fields (UsedBy and UsedOn). I am trying to use LINQ to insert new rows into the table but for some reason they are not persisting.
Here is my code:
var ...
I have an abstract base class for audit properties. For brevity say it has one property
Public MustInherit Class AbstractAuditableEntity
...
Public Property CreatedTime() As DateTimeOffset
...
End Class
And then my auditable domain objects inherit from this class
Public Class Source
Inherits AbstractAuditableEntity
...
Here's a little background on my solution:
ASP.Net MVC app
Using Linq-to-SQL with table-per-hierarchy inheritance
Using DataAnnotationsModelBinder as default
So I have a Device abstract class and then a series of derived classes (ServerDevice, DiskDevice, PSUDevice, etc) that inherit from it in the proscribed Linq-to-SQL way. I have...
Hi
every example I seen shows how to do a update query in linq to sql by doing this.
// grab entity you want to update
entity.UserId = "123"; // update the fields you want to update.
entity.Name = "bob";
Dbcontext.SubmitChanges();
I am wondering can you juse pass in a new object and have it figure it out?
Like could I do this?
En...
for example, I have a table TableA, with fields Field1, Field2 and Field3. My LINQ to SQL code is:
from c in a.TableAs select c
then I bind this query to a GridView named gvSample which only uses Field1 and Field2 of TableA.
then, when the LINQ to SQL query is enumerated, does the data of Field3 will be returned?
...
I'm fairly new to database programming in WinForms, and have been using BindingSource, DataSet, and TableAdapter controls to display data from an Access database in grid and Component One Chart controls.
The app is fairly simple right now - the user selects a row in the grid, and a related set of data points is plotted in the Chart cont...