|
-
Nov 21st, 2007, 09:28 PM
#1
Thread Starter
Addicted Member
[2.0] Date Problems inserting into SQL Server
Hey everyone,
Im having trouble inserting a date into sql server.
I get the following error when I run my stored procedurem which i am guessing is returned from the SQL Server
 Originally Posted by Error Message
Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
I am in australia, and as such, my date formats as dd/mm/yyyy. Below is what happens with my date object.
Code:
Request.CreateDate (Request is class, CreateDate is the date the request was created, with DateTime object type.)
Request.CreateDate = Convert.ToDateTime("22/11/2007");
My sql database for the create_date field is of type DateTime.
When I am debugging my code, and I hover my mouse over the Request.CreateDate property, it gives me the date information as Day 22, 11 Month, year 2007, so it is creating the date object correctly, however, when I insert it into the db, I get the afformentioned error, and I am assuming its reading it in mm/dd/yyyy format, and, of course, there is no 22nd month.
Any help on this would be infinitely appreciated.
Cheers,
Justin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|