Click here to Skip to main content
14,877,782 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Unable to update data table values Pin
Mou_kol12-Apr-21 7:06
MemberMou_kol12-Apr-21 7:06 
QuestionHour and minute slider Pin
Valakik8-Apr-21 9:49
MemberValakik8-Apr-21 9:49 
AnswerRe: Hour and minute slider Pin
OriginalGriff8-Apr-21 22:20
mveOriginalGriff8-Apr-21 22:20 
AnswerRe: Hour and minute slider Pin
BillWoodruff9-Apr-21 4:19
mveBillWoodruff9-Apr-21 4:19 
QuestionC# Linq Get Count of Joined Records Pin
Kevin Marois8-Apr-21 9:34
professionalKevin Marois8-Apr-21 9:34 
AnswerRe: C# Linq Get Count of Joined Records Pin
OriginalGriff8-Apr-21 9:40
mveOriginalGriff8-Apr-21 9:40 
GeneralRe: C# Linq Get Count of Joined Records Pin
Kevin Marois8-Apr-21 9:50
professionalKevin Marois8-Apr-21 9:50 
GeneralRe: C# Linq Get Count of Joined Records Pin
OriginalGriff8-Apr-21 10:05
mveOriginalGriff8-Apr-21 10:05 
I've no idea what your DB looks like, but if you have a table containing a foreign key to another, then it's pretty simple.
Assume a Invoices system for simplicity. It contains two tables:
Invoices
ID
InvoiceDate
CustomerID
...
InvoiceLines
ID
InvoiceID
ProductID
Quantity
UnitPrice
...

So to get the number of Lines per Invoice it's simple to use a group:
SQL
SELECT InvoiceID, COUNT(ID)
FROM InvoiceLines
GROUP BY InvoiceID

So if I issue two invoices:
ID = 1, InvoiceDate = #2021-04-07#, ...
ID = 2, InvoiceDate = #2021-04-08#, ...

ID = 1, InvoiceID = 1, ...
ID = 2, InvoiceID = 1, ...
ID = 3, InvoiceID = 1, ...
ID = 4, InvoiceID = 1, ...
ID = 5, InvoiceID = 2, ...
ID = 6, InvoiceID = 2, ...
ID = 7, InvoiceID = 2, ...
Then the query returns:
1, 4
2, 3
Which sounds like what you are looking for.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

QuestionClient Server Pin
Member 141922168-Apr-21 8:18
MemberMember 141922168-Apr-21 8:18 
AnswerRe: Client Server Pin
OriginalGriff8-Apr-21 8:45
mveOriginalGriff8-Apr-21 8:45 
AnswerRe: Client Server Pin
SeanChupas8-Apr-21 9:26
MemberSeanChupas8-Apr-21 9:26 
GeneralRe: Client Server Pin
Member 141922168-Apr-21 10:53
MemberMember 141922168-Apr-21 10:53 
GeneralRe: Client Server Pin
Dave Kreskowiak8-Apr-21 12:12
mveDave Kreskowiak8-Apr-21 12:12 
AnswerRe: Client Server Pin
Dave Kreskowiak8-Apr-21 10:34
mveDave Kreskowiak8-Apr-21 10:34 
AnswerRe: Client Server Pin
Mycroft Holmes8-Apr-21 12:24
professionalMycroft Holmes8-Apr-21 12:24 
GeneralRe: Client Server Pin
jschell9-Apr-21 14:44
Memberjschell9-Apr-21 14:44 
AnswerRe: Client Server Pin
jschell9-Apr-21 14:49
Memberjschell9-Apr-21 14:49 
QuestionCheck List Box Posting back to SQL Column Pin
Mike Mullins 20218-Apr-21 5:29
MemberMike Mullins 20218-Apr-21 5:29 
AnswerRe: Check List Box Posting back to SQL Column Pin
Mycroft Holmes8-Apr-21 12:28
professionalMycroft Holmes8-Apr-21 12:28 
GeneralRe: Check List Box Posting back to SQL Column Pin
Mike Mullins 20219-Apr-21 3:44
MemberMike Mullins 20219-Apr-21 3:44 
GeneralRe: Check List Box Posting back to SQL Column Pin
Mycroft Holmes9-Apr-21 12:17
professionalMycroft Holmes9-Apr-21 12:17 
QuestionNavigate to file, rename and move in mvc net core app Pin
Lmm Cams7-Apr-21 9:03
MemberLmm Cams7-Apr-21 9:03 
AnswerRe: Navigate to file, rename and move in mvc net core app Pin
OriginalGriff7-Apr-21 20:02
mveOriginalGriff7-Apr-21 20:02 
GeneralRe: Navigate to file, rename and move in mvc net core app Pin
Lmm Cams8-Apr-21 0:25
MemberLmm Cams8-Apr-21 0:25 
GeneralRe: Navigate to file, rename and move in mvc net core app Pin
OriginalGriff8-Apr-21 0:40
mveOriginalGriff8-Apr-21 0:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.