Saving a date

Discussion in 'ASP .Net' started by =?Utf-8?B?QnJhZA==?=, Dec 1, 2005.

  1. get the following error when I try to save a date:

    When converting a string to DateTime, parse the string to take the date
    before putting each variable in the DateTime object.

    I was using a calendar control thinking that might have been the problem so
    I am using just a text box for entry. In the ASP code for the Insert
    statement, I have this:
    <asp:controlParameter Name="InDate" Type="DateTime" ControlID="txtInDate" />


    I have double checked the SQL table to make sure that the field is DateTime
    and it is. Also, if I have not selected a date or the textbox contains no
    information then it does not error and just saves the field blank.


    What do I need to do to store this date?

    Thanks for the information.
    =?Utf-8?B?QnJhZA==?=, Dec 1, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?QnJhZA==?=

    Guest

    You can do it this way....


    Dim myDate as Date = Date.parse(txtInDate.text)
    , Dec 1, 2005
    #2
    1. Advertising

  3. I have been working most of today trying to figure out this date problem
    because that was in the error message, only to discover that is was NOT a
    date problem, but another field that is set to type decimal had a control
    parameter from a label (text). So what I did is to convert the text to
    double, store it in a session variable and then set the parameter to the
    session variable and voila!

    "Brad" wrote:

    > get the following error when I try to save a date:
    >
    > When converting a string to DateTime, parse the string to take the date
    > before putting each variable in the DateTime object.
    >
    > I was using a calendar control thinking that might have been the problem so
    > I am using just a text box for entry. In the ASP code for the Insert
    > statement, I have this:
    > <asp:controlParameter Name="InDate" Type="DateTime" ControlID="txtInDate" />
    >
    >
    > I have double checked the SQL table to make sure that the field is DateTime
    > and it is. Also, if I have not selected a date or the textbox contains no
    > information then it does not error and just saves the field blank.
    >
    >
    > What do I need to do to store this date?
    >
    > Thanks for the information.
    >
    =?Utf-8?B?QnJhZA==?=, Dec 1, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    594
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,243
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    511
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    718
    Richard Heathfield
    Nov 8, 2003
  5. Matt
    Replies:
    11
    Views:
    404
    Aaron Bertrand [MVP]
    Nov 8, 2003
Loading...

Share This Page