Click here to Skip to main content
13,087,941 members (73,786 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i have two date time picker named as follows;
dt_startweek and dt_endweek as two datetimepicker.

when i click the dt_startweek picker 21stdate in the dt_endweek picker five days 26th date to be displayed in the dt_endweek.

for that code as follows;

private void dt_startweek_ValueChanged(object sender, EventArgs e)
        DateTime dt = dt_startweek.Value;
        dt_endweek.Value = dt;
        DateTime startdate = dt_startweek.Value;
        DateTime enddate = dt_endweek.Value;
the above code is working fine no problem.

then i have one button called load when i click the load button that datepicker date 5 days to be saved in the data base.

for that saving the date into the can i write code to save in the database.

help me.

Date base design as follows;

Fac_sch_date Date time (Data type)

output i want in the table as follows;


the above date to be saved in the data base when i click the load button.

what date i choose in the dt_startweek that date to be saved in the database.

please help me.
Posted 29-Jan-13 3:12am
Updated 29-Jan-13 3:16am
kshitij_CodeMaster 29-Jan-13 9:27am
Dnt forget to say thanx who help u buddy.. its easy to copy n paste soln which u got frm smeone else...
Member 8054539 29-Jan-13 11:29am
ok to save the date time picker date in database when i click the button.

please help me.
Rgds & thanks

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

why not use the loop, when you want to do event Insert into database,
like this :
protected void Button1_Click(object sender, EventArgs e)
            var dtime = dt_startweek.Value;
            var data = new ArrayList();
            for (var i = 0; i < 6; i++)
                var xx = dtime.AddDays(i);
                // do for insert into database in here,can too..
// OR
//Your first capacity in each variable, then enter one of the database into your
            var x1 = data[0];// date 21 from arraylist index [0]
            var x2 = data[1];// date 22
            var x3 = data[2];// date 23
            var x4 = data[3];// date 24
            var x5 = data[4];// date 25
            var x6 = data[5];// date 26
  // OR Like This
            var d1 = dtime;
            var d2 = dtime.AddDays(1);
            var d3 = dtime.AddDays(2);
            var d4 = dtime.AddDays(3);
            var d5 = dtime.AddDays(4);
            var d6 = dtime.AddDays(5);

This parable is only sample code it .. just as a prefix to pave the way forward her your logic, associated with your coding

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2017
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