Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with inserting a date

Status
Not open for further replies.

phytos

Technical User
Oct 20, 2002
15
0
0
CY
im having a problem with inserting the date in a table.
In my access db the format is setup as dd/mm/yyyy and when i try to insert a record through a asp.net webpage i get the following error.

System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.GetDayOfNNY(DateTimeResult result, DateTimeRawInfo raw, DateTimeFormatInfo dtfi)
at System.DateTimeParse.ProcessTerminaltState(Int32 dps, DateTimeResult result, DateTimeRawInfo raw, DateTimeFormatInfo dtfi)
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s, IFormatProvider provider, DateTimeStyles styles)
at System.DateTime.Parse(String s, IFormatProvider provider)
at System.DateTime.Parse(String s)
at DreamweaverCtrls.DataSet.ConvertParameterValue(String strValue, Enum theType)
at DreamweaverCtrls.DataSet.AddParameters(IDbCommand myCommand)
at DreamweaverCtrls.DataSet.DoInit()

Any ideas how to fix this problem?
Thanks in advance

 
I think you have to add it as mm/dd/yyyy.
Just about everything Microsoft expects the US format.

Dazed and confused
 
It depends on how the database was set up.

But you can always use ISO-8601 format: yyyy-mm-dd as it always works.

But if you're inserting into a table, you can use ado parameters and use the datetime variable as-is, with no need to convert to a string (avoiding this potential problem entirely).

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top