Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Saving a date

Reply
Thread Tools

Saving a date

 
 
=?Utf-8?B?QnJhZA==?=
Guest
Posts: n/a
 
      12-01-2005
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.

 
Reply With Quote
 
 
 
 
neilphan@gmail.com
Guest
Posts: n/a
 
      12-01-2005
You can do it this way....


Dim myDate as Date = Date.parse(txtInDate.text)

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QnJhZA==?=
Guest
Posts: n/a
 
      12-01-2005
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.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP General 11 11-08-2003 11:24 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments