I have the following information
var details = Details.Where(d => d.isActive);
I would like to query another table, Authorizations, that has a FK to Details, and get the sum amounts of the authorizations that are contained within the details object grouped by the detail and a FundCode.
Details (1 to many) Authorizations
Seems si...
How would I write a linq to sql statement for the following tsql?
select
count(*),
sum(Amount),
avg(Amount),
min(Amount),
max(Amount)
from
TableName
...
I'm working on a little side app for a client whereby they provide me with a list of cities and I have to insert them into the database and associate them with their parent records.
Example:
ID | PID | Region
1 0 California
2 1 Los Angeles
3 1 San Fransisco
Now my code looks lik...
We have this code:
private IList<InfoRequest> GetBy(Func<InformationRequest, string> func, string searchby)
{
var requests = _dc.InformationRequests
.Where(x => func.Invoke(x).Contains(searchby))
.OrderBy(y => y.RequestDate);
return Mapper.Map<InformationRequest[], InfoRequest[]>(requ...
I have the query below:
var users = (from a in dc.UserRoles
join u in dc.Users on a.intUserId equals u.ID
join r in dc.Roles on a.intRoleId equals r.ID
where r.intClientId == clientID
select new UserRoleDetail
...
HI,
I am developing asp.net mvc site with linq-to-sql we are having 1000 cocurrent users and we are having performance problems.
I have found that stackovewflow is also build on linq-to-sql? So can anybody know how they improved performance.
Without line performance was good each page are loaded in 3 seconds but after migrating to lin...
Code:
public ActionResult Create(Group group)
{
if (ModelState.IsValid)
{
group.int_CreatedBy = 1;
group.dtm_CreatedDate = DateTime.Now;
var Groups = Request["Groups"];
int GroupId = 0;
GroupFeature GroupFeature=new GroupFeature();
foreach (v...
I am using LinqToSql as you've seen on subject.
I've a table and some colums in it. There is one colum to show the state of record.
0 : Not approved yet
1 : Approved
2 : Deleted
When the record inserted at first, its value is 0 (default value).
When user approved it its value is changing to 1 but i'm getting this error:
Value of me...
This might be a Windows 7 issue, but calling
using (var context = new DataClassesDataContext())
{
if (!context.DatabaseExists())
{
context.CreateDatabase();
}
}
Results in the following error:
System.Data.SqlClient.SqlException was
unhandled Message=Database
'C:\Temp\SmallBusinessManager.mdf'
already ex...
Hi
How can I do these 2 scenarios.
Currently I am doing something like this
public class Repository
{
private LinqtoSqlContext dbcontext = new LinqtoSqlContext();
public void Update()
{
// find record
// update record
// save record ( dbcontext.submitChanges()
}
public void Insert()
{
// make a dat...
I am using Linq to SQL to call a stored procedure which runs a full-text search and returns the rank plus a few specific columns from the table Article. The rank column is the rank returned from the SQL function FREETEXTTABLE(). I've added this sproc to the O/R designer with return type Article.
This is working to get the columns I ne...
This problem drives me crazy.
All I'm trying to do is writing some child record and update the parent with some basic increment. When I submit the changes an ChangeConflictException is thorwn..
Here's the code
using (BizNetDB db = new BizNetDB())
{
var dbServiceCall = db.ServiceCalls.SingleOrDefault(
x => x.ServiceCallID ...
I am performing a select query using the following Linq expression:
Table<Tbl_Movement> movements = context.Tbl_Movement;
var query = from m in movements
select new MovementSummary
{
Id = m.DocketId,
Created = m.DateTimeStamp,
CreatedBy = m.Tbl_User.FullName,
...
In my schema I have two database tables. relationships and relationship_memberships. I am attempting to retrieve all the entries from the relationship table that have a specific member in it, thus having to join it with the relationship_memberships table. I have the following method in my business object:
public IList<DBMappings....
I am trying to use the ASP.NET Dynamic Data Filtering project, but I'm running into a problem during the configuration.
I'm following the instructions on the author's blog, and everything works like described. Then it tells me to change the datasource using the designer view. I am told to select the "GridDataSource" in the "Configure da...
I simply want to include a row number against the returned results of my query.
I found the following post that describes what I am trying to achieve but gives me an exception
http://vaultofthoughts.net/LINQRowNumberColumn.aspx
"An expression tree may not contain an assignment operator"
In MS SQL I would just use the ROWNUMBER() fun...
I have generated a LinqtoSQL mapping xml file, which I have a valid XSD schema that I check to make sure the XML is correct.
Now I want to check that the field type match the Model/Interface
for example:
checking that the nullable fields are nullable
that int are int etc
anyone got any ideas if I can do this?
...
All I'm after doing is this:
SELECT CallTypeID, Count(CallTypeID) as NumberOfCalls
FROM [Helpdesk_HR].[dbo].[CallHeader]
WHERE CallHeader.DateOpened <= GETDATE()-7
GROUP BY CallTypeID
in LINQ. But I can't work out a way of doing it and getting it to work. I would use Linqer, but my company won't pay for it at present.
Any help is gre...
I have a linq to sql statement that inserts records in the database. If there is a duplicate, it throws Primary key violation .
after this happens, whenever i try to execute any other statement, it repeatedly shows this error. Is this a problem of transaction not getting closed. Also how to handle transactions in a more reliable way in ...
I have a table company which holds the company_id, company_name and other details.
I have a table subcontracts which has a company_id column that maps to company.company_id.
How can I write a select statement to get all active companies which have not been assigned to an active subcontract? IE The company_id cannot be found in subcont...