Click here to Skip to main content
11,479,162 members (49,621 online)
Rate this: bad
good
Please Sign up or sign in to vote.
I am trying to program and mostly use the User Interface in design-time. So far, all has been well and I have only recently met a problem.

The thing is, that I know how to do this by writing the code and sql queries in the Form. Like i.e :

sqlConnection con = new sqlConnection (conString);
//
// More code
//
for (int i = 1; i <= 12; i++)
{
    foreach (string row in ard.ardcruise)
    {
        bard.bardYear = ard.ardYear;
        bard.bardcruise_id = row.substring(0, row.IndexOf(" "));
    }
 
    SELECT ("cruise_id, DATEPART(dd, dt) As s_day, AVG(use) AS AVG_use FROM use" +
    "WHERE (cruise_id = " + bard.bardcruise_id + " AND use != 0 " + "AND DATEPART(mm, dt) = " + i.ToString() + " AND DATEPART(yyyy, dt) = " + bard.bardYear + " AND DATEPART(dd, dt) = " + d.ToString() + ") GROUP BY cruise_id, DATEPART(dd, dt) ORDER BY s_day", con);
 
    dscon.Clear();
    dacon.Fill(dscon, "AVG");

My question is.... How do I do the same in Design-time with User interface? How do I select month, year and day in DATEPART with dateTimePicker ?

In the end I would like to show AVG_use and s_day in a chart where cruise_id is Legend 1 or more depending on user selection.
I would like to write the sql statements in the query builder in visual studio 2010 professional

Thanks
Posted 21-Mar-13 2:17am
Edited 21-Mar-13 2:45am
(no name)93.4K
v3
Comments
Maciej Los at 21-Mar-13 13:16pm
   
If you want to do it on sql serer side, provide example data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 215
1 OriginalGriff 205
2 F-ES Sitecore 185
3 Frankie-C 120
4 DamithSL 85
0 Sergey Alexandrovich Kryukov 7,890
1 OriginalGriff 7,441
2 Sascha Lefèvre 3,064
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 21 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100