"Arithmetic overflow error converting expression to data type datetime" error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Saso Zagoranski

    #1

    "Arithmetic overflow error converting expression to data type datetime" error

    Hi!

    I have created an SqlCommand object and I have set some parameters to it...
    One of the parameters is of the DateTime type;

    here is the code:
    sqlCommand.Para meters[0].Value = DateTime.Parse( this.DateTextBo x.Text);
    sqlCommand.Exec uteNonReader();

    I get the error:
    Arithmetic overflow error converting expression to data type datetime

    thanks,
    saso



  • Saso Zagoranski

    #2
    Re: "Arithmeti c overflow error converting expression to data type datetime" error

    Hi!
    [color=blue]
    > What is in this.DataTextBo x.Text[/color]

    DateTextBox is just a TextBox where the user enters a date (dd/mm/yy)...
    the same thing happens if I enter DateTime.Now insted... I still get the
    same error...


    "Saso Zagoranski" <saso.zagoransk i@guest.arnes.s i> wrote in message
    news:bp82kk$6db $1@planja.arnes .si...[color=blue]
    > Hi!
    >
    > I have created an SqlCommand object and I have set some parameters to[/color]
    it...[color=blue]
    > One of the parameters is of the DateTime type;
    >
    > here is the code:
    > sqlCommand.Para meters[0].Value = DateTime.Parse( this.DateTextBo x.Text);
    > sqlCommand.Exec uteNonReader();
    >
    > I get the error:
    > Arithmetic overflow error converting expression to data type datetime
    >
    > thanks,
    > saso
    >
    >
    >[/color]


    Comment

    • Peter Koen

      #3
      Re: &quot;Arithmeti c overflow error converting expression to data type datetime&quot; error

      "Saso Zagoranski" <saso.zagoransk i@guest.arnes.s i> wrote in news:bp85pd$93l
      $1@planja.arnes .si:
      [color=blue]
      > Hi!
      >[color=green]
      >> What is in this.DataTextBo x.Text[/color]
      >
      > DateTextBox is just a TextBox where the user enters a date (dd/mm/yy)...
      > the same thing happens if I enter DateTime.Now insted... I still get the
      > same error...
      >[/color]

      And you are sure you aren't using us-time format? (mm/dd/yyyy)

      this error usualy happens if you are entering dates with the wrong
      formating.

      greets
      Peter

      --
      ------ooo---OOO---ooo------

      Peter Koen - www.kema.at
      MCAD CAI/RS CASE/RS IAT

      ------ooo---OOO---ooo------

      Comment

      • Saso Zagoranski

        #4
        Re: &quot;Arithmeti c overflow error converting expression to data type datetime&quot; error

        how can I check, which format I'm using?

        saso

        "Peter Koen" <koen-newsreply&snusn u.at> wrote in message
        news:uHF$itGrDH A.2304@TK2MSFTN GP11.phx.gbl...[color=blue]
        > "Saso Zagoranski" <saso.zagoransk i@guest.arnes.s i> wrote in[/color]
        news:bp85pd$93l[color=blue]
        > $1@planja.arnes .si:
        >[color=green]
        > > Hi!
        > >[color=darkred]
        > >> What is in this.DataTextBo x.Text[/color]
        > >
        > > DateTextBox is just a TextBox where the user enters a date (dd/mm/yy)...
        > > the same thing happens if I enter DateTime.Now insted... I still get the
        > > same error...
        > >[/color]
        >
        > And you are sure you aren't using us-time format? (mm/dd/yyyy)
        >
        > this error usualy happens if you are entering dates with the wrong
        > formating.
        >
        > greets
        > Peter
        >
        > --
        > ------ooo---OOO---ooo------
        >
        > Peter Koen - www.kema.at
        > MCAD CAI/RS CASE/RS IAT
        >
        > ------ooo---OOO---ooo------[/color]


        Comment

        • Saso Zagoranski

          #5
          Re: &quot;Arithmeti c overflow error converting expression to data type datetime&quot; error

          although I just tried entering this date: 1.1.2003
          this should be parsed no matter the format, right?

          "Saso Zagoranski" <saso.zagoransk i@guest.arnes.s i> wrote in message
          news:bp91ut$4cq $1@planja.arnes .si...[color=blue]
          > how can I check, which format I'm using?
          >
          > saso
          >
          > "Peter Koen" <koen-newsreply&snusn u.at> wrote in message
          > news:uHF$itGrDH A.2304@TK2MSFTN GP11.phx.gbl...[color=green]
          > > "Saso Zagoranski" <saso.zagoransk i@guest.arnes.s i> wrote in[/color]
          > news:bp85pd$93l[color=green]
          > > $1@planja.arnes .si:
          > >[color=darkred]
          > > > Hi!
          > > >
          > > >> What is in this.DataTextBo x.Text
          > > >
          > > > DateTextBox is just a TextBox where the user enters a date[/color][/color][/color]
          (dd/mm/yy)...[color=blue][color=green][color=darkred]
          > > > the same thing happens if I enter DateTime.Now insted... I still get[/color][/color][/color]
          the[color=blue][color=green][color=darkred]
          > > > same error...
          > > >[/color]
          > >
          > > And you are sure you aren't using us-time format? (mm/dd/yyyy)
          > >
          > > this error usualy happens if you are entering dates with the wrong
          > > formating.
          > >
          > > greets
          > > Peter
          > >
          > > --
          > > ------ooo---OOO---ooo------
          > >
          > > Peter Koen - www.kema.at
          > > MCAD CAI/RS CASE/RS IAT
          > >
          > > ------ooo---OOO---ooo------[/color]
          >
          >[/color]


          Comment

          Working...