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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. out-of-range datetime value

out-of-range datetime value

Scheduled Pinned Locked Moved ASP.NET
csharpsysadminhelpquestionannouncement
7 Posts 3 Posters 1 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.
  • N Offline
    N Offline
    NinaWilliam
    wrote on last edited by
    #1

    Hi there I wrote a web application and it was working fine with no errors in my local server and the live server. My system lost its data and the hard drive got corrupted. So my hard drive was replaced with a new one. When I configure the web application on my new hard drive and run it, it was working ok except for the part that is has date selection on it I get the following error Exception Type: System.Data.SqlClient.SqlException Exception Message: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. Exception Source: .Net SqlClient Data Provider Exception Target Site: Read I didn’t change the code or anything; the same version is working on the live server with no issues. I don’t know why it is giving me this error in my machine. Any ideas??

    A S 2 Replies Last reply
    0
    • N NinaWilliam

      Hi there I wrote a web application and it was working fine with no errors in my local server and the live server. My system lost its data and the hard drive got corrupted. So my hard drive was replaced with a new one. When I configure the web application on my new hard drive and run it, it was working ok except for the part that is has date selection on it I get the following error Exception Type: System.Data.SqlClient.SqlException Exception Message: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. Exception Source: .Net SqlClient Data Provider Exception Target Site: Read I didn’t change the code or anything; the same version is working on the live server with no issues. I don’t know why it is giving me this error in my machine. Any ideas??

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      NinaWilliam wrote:

      The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

      Problem is here. Did you check the stack Trace? Which part of your code throwing the error ? Have a look The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

      cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article

      N 1 Reply Last reply
      0
      • A Abhijit Jana

        NinaWilliam wrote:

        The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

        Problem is here. Did you check the stack Trace? Which part of your code throwing the error ? Have a look The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

        cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article

        N Offline
        N Offline
        NinaWilliam
        wrote on last edited by
        #3

        I don't think that something is wrong with the code... because it is working on the other server.

        A 1 Reply Last reply
        0
        • N NinaWilliam

          I don't think that something is wrong with the code... because it is working on the other server.

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          Did you gone through with this Thred

          cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article

          1 Reply Last reply
          0
          • N NinaWilliam

            Hi there I wrote a web application and it was working fine with no errors in my local server and the live server. My system lost its data and the hard drive got corrupted. So my hard drive was replaced with a new one. When I configure the web application on my new hard drive and run it, it was working ok except for the part that is has date selection on it I get the following error Exception Type: System.Data.SqlClient.SqlException Exception Message: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. Exception Source: .Net SqlClient Data Provider Exception Target Site: Read I didn’t change the code or anything; the same version is working on the live server with no issues. I don’t know why it is giving me this error in my machine. Any ideas??

            S Offline
            S Offline
            Sabari MD
            wrote on last edited by
            #5

            string Text; IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true); Text = GDate.Trim(); DateTime Dt = DateTime.Parse(Text, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault); return Dt.Date.ToShortDateString(); Try this code I thought this will help you

            sabarimd

            N 1 Reply Last reply
            0
            • S Sabari MD

              string Text; IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true); Text = GDate.Trim(); DateTime Dt = DateTime.Parse(Text, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault); return Dt.Date.ToShortDateString(); Try this code I thought this will help you

              sabarimd

              N Offline
              N Offline
              NinaWilliam
              wrote on last edited by
              #6

              Thank you for your help... but I am still having the problem and I don't think there is somthing wrong with the code... I thing I ahve to fix it in my system settings but I don't know hoe to do that... Anyone can help me?

              N 1 Reply Last reply
              0
              • N NinaWilliam

                Thank you for your help... but I am still having the problem and I don't think there is somthing wrong with the code... I thing I ahve to fix it in my system settings but I don't know hoe to do that... Anyone can help me?

                N Offline
                N Offline
                NinaWilliam
                wrote on last edited by
                #7

                Hi guys ^_______^ I was able to fix the problem by replacing 102 to 103 in the following code line... SELECT Appointments.AppointDate WHERE (Appointments.AppointDate = CONVERT(DATETIME, '" & date1 & "', 103)) and it works fine now ^___^ Happy Programming :) :) :)

                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