Tagged Questions
0
votes
0answers
13 views
how to show the following output in wpf datagrid depending on a condition
I am displaying the Processing Time data in a datagrid as follows
using the following statement
var duration_query = this.db.Events
.Where(p => ...
-1
votes
2answers
44 views
updating multiple records in database with linq to sql without loop, is it possible?
ok, let say i want to update multiple rows in database at once, without looping, if we do it with loop, it might look like this :
var products = (from prod in context.Products
where ...
1
vote
0answers
63 views
Linq to SQL for EntityFramework.Extensions Update() method with ?? operator
I have a method with several optional parameters that then updates the database using a LINQ query. I would like to update the record such that the optional fields are only saved if they were supplied ...
2
votes
1answer
62 views
SQL to LINQ Query with date in where clause is not working
I try to query database item via LINQ but it is not working. The exception is just:
Object reference not set to an instance of an object.
The stacktrace is as unhelpful as the exception itself:
...
0
votes
1answer
29 views
Linq query to sum values from tables
I have a LINQ query, which takes an invoice, looks up the quantity and unit price of each item attached, and in another linked table, looks up any payments made against the invoice.
Currently this ...
0
votes
0answers
30 views
SQL to Linq (order and group by hour interval)
I had a SQL needed to convert into Linq, looked everywhere still failed. please help me out
SELECT
hour(recordoriginaldata.StartRecordTime) as hour,
sum(recordoriginaldata.RecordLength) as ...
-2
votes
1answer
37 views
LINQ combined columns contain
I have three fields; first name, middle initial, and last name. How would I do a LINQ query to check if:
x = query // i.e. john
y = first name + " " + middle initial + " " last name // i.e. john a ...
4
votes
1answer
66 views
Viewmodel and LINQ query to represent 4 linked tables in Asp.Net MVC
I'm using a typical invoice system as a test for developing MVC and ViewModel knowledge, before tackling migrating my employers inhouse systems from asp to asp.net MVC.
I know ViewModels are the ...
0
votes
1answer
30 views
row number with help of linq
my table consists of 3 columns(sno,name,age) now i am retrieving this table from the database with extra column(row number) ,i used the following code
select * from (
select ROW_NUMBER() over ...
0
votes
0answers
30 views
Convert SQL query into LINQ query in VB
I would like to know how to convert the SQL query listed below into a LINQ query in VB:
SELECT * FROM
(SELECT SUM(t.Amt) Tax, g.GenQuoteDetails_Id, g.lastTkdt, g.QuoteDt, g.BaseFareCurrency, ...
0
votes
2answers
46 views
LINQ Group By and aggregate fields
I've always struggled with grouping in LINQ, I'd like to group based on the date part of a datetime field and aggregate other fields.
Example table layout
myDateField myIntField1 myIntField2 ...
0
votes
1answer
22 views
Linq DataContext.CreateDatabase() force SQL Server 2005
I'm using Linq DataContext.CreateDatabase() to generate a database. Currently it's generating a SQL Server 2008 database. I would like to know if it's possible to make CreateDatabase() generate a SQL ...
0
votes
1answer
41 views
linq left outer join object reference not set to an instance of an object
i am using left outer join in this query below. the variable fgi is coming null so so the line after that in where it giving object reference error. how can solve it?.
var a = (from e1 in ...
4
votes
1answer
120 views
What's the better way to write this linq query?
SQL:
SELECT node.CategoryId,
node.CategoryName,
node.Description,
node.Lft, node.Rgt,
node.ShowOnMenu,
(COUNT(parent.CategoryName) - 1) AS Level,
(CASE WHEN node.Lft = ...
0
votes
0answers
33 views
Linq To Sql Category Sub Category Count Performans
Product Table : ID Name ...
Category Table : ID ParentCategoryID Name
ProductCategories Table : ID CatID ProdID
and.. ProductCategories in CatID foreign key and ProdID foreign key
multiple SQL ...