Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Easy DateTime question

Easy DateTime question

Scheduled Pinned Locked Moved Database
questiondatabasehelptutorial
36 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K kubben

    Here is the content of the link: Subtracts the specified date and time from this instance. Namespace: System Assembly: mscorlib (in mscorlib.dll) Syntax Visual Basic (Declaration) Public Function Subtract ( _ value As DateTime _ ) As TimeSpan Visual Basic (Usage) Dim instance As DateTime Dim value As DateTime Dim returnValue As TimeSpan returnValue = instance.Subtract(value) C# public TimeSpan Subtract ( DateTime value ) C++ public: TimeSpan Subtract ( DateTime value ) J# public TimeSpan Subtract ( DateTime value ) JScript public function Subtract ( value : DateTime ) : TimeSpan Parameters value An instance of DateTime. Return Value A TimeSpan interval equal to the date and time represented by this instance minus the date and time represented by value. Exceptions Exception type Condition ArgumentOutOfRangeException The result is less than MinValue or greater than MaxValue. Remarks This method does not change the value of this DateTime object. Instead, a new TimeSpan is returned whose value is the result of this operation. Before subtracting DateTime objects, insure that the objects represent times in the same time zone. Otherwise, the result will include the difference between time zones. Example The following code example demonstrates the Subtract method and operator. Visual Basic Copy Code Dim date1 As New System.DateTime(1996, 6, 3, 22, 15, 0) Dim date2 As New System.DateTime(1996, 12, 6, 13, 2, 0) Dim date3 As New System.DateTime(1996, 10, 12, 8, 42, 0) Dim diff1 As System.TimeSpan ' diff1 gets 185 days, 14 hours, and 47 minutes. diff1 = date2.Subtract(date1) Dim date4 As System.DateTime ' date4 gets 4/9/1996 5:55:00 PM. date4 = date3.Subtract(diff1) Dim diff2 As System.TimeSpan ' diff2 gets 55 days 4 hours and 20 minutes. diff2 = System.DateTime.op_Subtraction(date2, date3) Dim date5 As System.DateTime ' date5 gets 4/9/1996 5:55:00 PM. date5 = System.DateTime.op_Subtraction(date1, diff2) Ben

    B Offline
    B Offline
    bernie_011
    wrote on last edited by
    #18

    thanks for that friend, I got it now. I have new question, how can i add gridview header above header?.. Thanks Bernie

    K 1 Reply Last reply
    0
    • B bernie_011

      thanks for that friend, I got it now. I have new question, how can i add gridview header above header?.. Thanks Bernie

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #19

      You can try to use the gridview pager template for that sort of thing. Ben

      B 1 Reply Last reply
      0
      • K kubben

        You can try to use the gridview pager template for that sort of thing. Ben

        B Offline
        B Offline
        bernie_011
        wrote on last edited by
        #20

        What are the settings to be change for me to show the header on load?. I found out that it depends on the number of rows. Thanks bernie

        K 1 Reply Last reply
        0
        • B bernie_011

          What are the settings to be change for me to show the header on load?. I found out that it depends on the number of rows. Thanks bernie

          K Offline
          K Offline
          kubben
          wrote on last edited by
          #21

          In the gridview prerender event you need this kind of code: if (!GridView1.TopPagerRow.Visible) { GridView1.TopPagerRow.Visible = true; } Ben

          B 1 Reply Last reply
          0
          • K kubben

            In the gridview prerender event you need this kind of code: if (!GridView1.TopPagerRow.Visible) { GridView1.TopPagerRow.Visible = true; } Ben

            B Offline
            B Offline
            bernie_011
            wrote on last edited by
            #22

            this is a C# code right?how about in VB?. i tried to write as if GridView1.TopPagerRow.Visible = false then GridView1.TopPagerRow.Visible = true but i got some error "Object reference not set to an instance of an object." is that because my gridview was controlled by dropdown?.How can i do that? Bernie

            K 1 Reply Last reply
            0
            • B bernie_011

              this is a C# code right?how about in VB?. i tried to write as if GridView1.TopPagerRow.Visible = false then GridView1.TopPagerRow.Visible = true but i got some error "Object reference not set to an instance of an object." is that because my gridview was controlled by dropdown?.How can i do that? Bernie

              K Offline
              K Offline
              kubben
              wrote on last edited by
              #23

              You need to turn paging on. Set the page size to be really big so you only have one page. Ben

              B K 13 Replies Last reply
              0
              • K kubben

                You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                B Offline
                B Offline
                bernie_011
                wrote on last edited by
                #24

                is that the only setting that i need? it will not display the next or previous? Bernie

                1 Reply Last reply
                0
                • K kubben

                  You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                  B Offline
                  B Offline
                  bernie_011
                  wrote on last edited by
                  #25

                  I set the page size to 10000 but it doesnt show the pager, I got some error in pre render event. null reference. My gridview is controlled by dropdown Bernie

                  1 Reply Last reply
                  0
                  • K kubben

                    You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                    K Offline
                    K Offline
                    kubben
                    wrote on last edited by
                    #26

                    You do need to check for Nothing before you try to do anything. The pre render actually gets called early enough that sometimes the pager hasn't be created yet. Ben

                    1 Reply Last reply
                    0
                    • K kubben

                      You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                      K Offline
                      K Offline
                      kubben
                      wrote on last edited by
                      #27

                      You have to set up the next and previous settings for them to show up. Ben

                      1 Reply Last reply
                      0
                      • K kubben

                        You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                        B Offline
                        B Offline
                        bernie_011
                        wrote on last edited by
                        #28

                        Hi, I have a report viewer, I have tables on my report. I set the hideDuplicates to my dataSet, It hides the data but still adding row on below, any idea about that?. I dont want to display row without data below in my table Thanks Bernie

                        1 Reply Last reply
                        0
                        • K kubben

                          You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                          K Offline
                          K Offline
                          kubben
                          wrote on last edited by
                          #29

                          I would guess that some spaces are being returned or something like that so there is some data being returned. That is my best guess. Ben

                          1 Reply Last reply
                          0
                          • K kubben

                            You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                            B Offline
                            B Offline
                            bernie_011
                            wrote on last edited by
                            #30

                            i have deployed my program in IIS, my report viewer works on my project but when i deployed it on IIS error was display, An error occurred during local report processing. The definition of the report 'Main Report' is invalid. The report definition is not valid. Details: Data at the root level is invalid. Line 1, position 1. Any idea about this? thank you very much.. Bernie

                            1 Reply Last reply
                            0
                            • K kubben

                              You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                              B Offline
                              B Offline
                              bernie_011
                              wrote on last edited by
                              #31

                              i found the solution friend. I put the data item in header or footer not in "details" and it works. my problem now is when i deploy it on IIS, the reportViewer does not work. Bernie

                              1 Reply Last reply
                              0
                              • K kubben

                                You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                                K Offline
                                K Offline
                                kubben
                                wrote on last edited by
                                #32

                                My first guess would be that the crystel report view dlls were not distributed with your site. If they were distributed then it must be the format of the dataset itself. Perhaps the report is expecting a root level name of the dataset and isn't getting that. Perhaps the dataset it self is null. Hard to say for sure. Ben

                                1 Reply Last reply
                                0
                                • K kubben

                                  You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                                  B Offline
                                  B Offline
                                  bernie_011
                                  wrote on last edited by
                                  #33

                                  my report viewer is working project preview, but when i deploy it in IIS it does not work. but by the way lets forget about that. I am downloading SSRE, it has reporting options. ' I have questions about dateTime, my date Format is 2007-MARCH-23 yyyy-MONTH-dd, I have 3 dates 2007-MARCH-23,2007-MARCH-24 and 2007-APRIL-01, i have query using BETWEEN, SELECT * FROM table1 WHERE date BETWEEN '2007-MARCH-23' AND '2007-APRIL-01' but it returns no rows, but if my query is SELECT * FROM table1 WHERE date BETWEEN '2007-APRIL-01' AND '2007-MARCH-24' it returns the rows. Base on my query SELECT MAX(date),MIN(date) FROM table1, '2007-APRIL-01' is the minimum. any idea about that?. How can i have between queries? Bernie

                                  1 Reply Last reply
                                  0
                                  • K kubben

                                    You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                                    K Offline
                                    K Offline
                                    kubben
                                    wrote on last edited by
                                    #34

                                    Don't use between. I would use >= and <= since between is > and < SELECT * FROM table1 WHERE date >= '2007-MARCH-23' AND date <='2007-APRIL-01' I don't know for sure if that will help or not. Ben

                                    1 Reply Last reply
                                    0
                                    • K kubben

                                      You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                                      B Offline
                                      B Offline
                                      bernie_011
                                      wrote on last edited by
                                      #35

                                      Hi, I am using Create User Wizard for membership. How can i add some fields like "FirstName" and "LastName" in CreateUser Wizard and Store it in Aspnet_Profile or in the other table. I want also to store userName and password in "Members" table. Thank you and God Bless! Bernie

                                      1 Reply Last reply
                                      0
                                      • K kubben

                                        You need to turn paging on. Set the page size to be really big so you only have one page. Ben

                                        K Offline
                                        K Offline
                                        kubben
                                        wrote on last edited by
                                        #36

                                        Are you using the aspNet_membership tables? There is a standard membership group of tables that can be created automatically if you run a certain sql script. I would suggest using those tables since they were desiged to work with the create user wizard etc. Ben

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • World
                                        • Users
                                        • Groups