TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Goran Bibic
479
2.9k
197.9k
Select from SQL when combo box selection index changed c#
May 20 2018 1:24 PM
Select from SQL for workers work hours monthly when chose frome combo box
string saveStaff =
"SELECT [radnik] as Radnik,SUM(cast((CASE WHEN DATEPART(WEEKDAY, vrijemeprijave) in (1, 7) then 0 else (CASE WHEN(DATEDIFF(SECOND, vrijemeprijave, vrijemeodjave) / 3600) > 8 THEN 8 ELSE(DATEDIFF(SECOND, vrijemeprijave, vrijemeodjave) / 3600) END) end)as float)) AS radni_sati,"
+
"SUM(cast((CASE WHEN DATEPART(WEEKDAY, vrijemeodjave) in (1, 7) then(DATEDIFF(SECOND, vrijemeprijave, vrijemeodjave) / 3600) else(case when(DATEDIFF(SECOND, vrijemeprijave, vrijemeodjave) / 3600) > 8 then((DATEDIFF(SECOND, vrijemeprijave, vrijemeodjave) / 3600) - 8) ELSE 0 END) end)as float)) AS 'Prekovremeni'"
+
"from[prijava_radnika]"
+
"where MONTH([vrijemeprijave]) = MONTH('"
+ mjeseccomboBox.Text.ToString(
) +
"') "
+
"group by[radnik]"
;
Combo box fill
private
void
punjenje_comboboxa_mjesecgodina()
{
mjeseccomboBox.DataSource = CultureInfo.InvariantCulture.DateTimeFormat
.MonthNames.Take(12).ToList();
mjeseccomboBox.SelectedItem = CultureInfo.InvariantCulture.DateTimeFormat
.MonthNames[DateTime.Now.AddMonths(-1).Month - 1];
godinacomboBox.DataSource = Enumerable.Range(1983, DateTime.Now.Year - 1983 + 1).ToList();
godinacomboBox.SelectedItem = DateTime.Now.Year;
}
Reply
Answers (
1
)
Function and Method
How to insert image into merged cell. (ClosedXML)