16,022,669 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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!
PeterHall
31-Jul-13 7:11am
View
I get 2 errors,
1) I get identifier expected. at code: reader2["PartNumber"].tostring()
2) I also get Operator '+' is not defined for types 'string' and 'system.data.sqlclient.sqldatareader'
PeterHall
31-Jul-13 6:38am
View
I changed the datatype in both currentstock and minimumrequired in my table structure to decimal(18, 0).
' Dim subject As String
Dim body As String
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = "#####;Initial Catalog=#####;Integrated Security=True"
con.Open()
cmd.Connection = con
cmd.CommandText = "SELECT * FROM [" + dbase + "] WHERE CurrentStock < MinimumRequired"
Dim reader2 As SqlDataReader = cmd.ExecuteReader
body = title + " Stock Control System" + Environment.NewLine + "Time: " + Date.Now + Environment.NewLine + "##########################################" + Environment.NewLine + Environment.NewLine + "This is an automated email please do not reply!" + Environment.NewLine + Environment.NewLine + "The parts below have reached its reorder level. Please place the required orders: " + Environment.NewLine + Environment.NewLine + "Product Details are as follows:" + Environment.NewLine
If reader2.HasRows Then
While reader2.Read()
body = body + "---------------------------------" + Environment.NewLine + "Part Number: " + reader2("PartNumber") + Environment.NewLine + "Description: " + reader2("Description") + Environment.NewLine + Environment.NewLine + "Current Stock: " + reader2("CurrentStock") & Environment.NewLine + "Minimum Required: " + reader2("MinimumRequired") & Environment.NewLine
End While
body = body + Environment.NewLine + "---------------------------------" + Environment.NewLine
reader2.Close()
Dim MyMailMessage As New MailMessage()
..... Then it starts the email stuff .....
PeterHall
31-Jul-13 6:28am
View
On the dropdown box i selected "decimal(18, 0)" in visual studio.
Heres the exception it threw:
System.InvalidCastException: Conversion from string "Conformal Coating Stock Control " to type 'Double' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
--- End of inner exception stack trace ---
PeterHall
31-Jul-13 6:22am
View
I tried both int and decimal, it seemed to throw an exception "Conversion from string "Stock Control " to type 'Double' is not valid.
Any ideas?
PeterHall
31-Jul-13 6:17am
View
varchar(MAX),
Cheers
PeterHall
31-Jul-13 6:16am
View
ah right, just checked now my datatype in the sql table is varchar(MAX) for both current stock and minimum required, what would I need to set that to?
Thanks
Show More