Click here to Skip to main content
15,908,834 members

Comments by PeterHall (Top 11 by date)

PeterHall 26-Jun-14 11:13am View    
Worked brilliantly, quick question, that's all working now summing the seconds with the beginning and end date, but how would I add the amount of seconds in a certain group.

E.g. i've expanded my db to include a "status" column, so each row would show.

Date Status Seconds
----------------------------------------
26/06/14 Running 3
26/06/14 Break 5
26/06/14 Running 8
26/06/14 Repair 2

How would I count each one separately?

I've tried to count just one just typing the status i want to count into "runningl" but with no luck with the code below:

cmd.Parameters.Clear()
cmd.CommandText = "SELECT SUM(seconds) FROM sqlccmlinestatus WHERE status @status1 and startdate BETWEEN @BEG AND @END"
cmd.Parameters.AddWithValue("@status1", runningl.Text)
cmd.Parameters.AddWithValue("@BEG", DateTimePicker1.Value.Date)
cmd.Parameters.AddWithValue("@END", DateTimePicker2.Value.Date)
runningseconds = cmd.ExecuteScalar()
runninglabel.Text = runningseconds

Many Thanks,
Pete
PeterHall 19-Sep-13 2:56am View    
anyone?
PeterHall 10-Sep-13 10:48am View    
i've just tried you solution, got some different errors e.g.

"The best overloaded method match for 'CTCAM3.MainForm.CheckForMatching(byte[*,*], byte[*,*])' has some invalid arguments"

and

"Argument 2: cannot convert from 'object' to 'byte[*,*]'"

any other ideas?
PeterHall 10-Sep-13 10:36am View    
How would I go about that?
PeterHall 31-Jul-13 9:11am View    
Worked Like a Charm! - Converted it to VB,

Cheers Adarsh!