Alter Date column in MySQL - assistance

I am getting the following error on an image upload page that writes to a mysql database.

 [ODBC 5.1 Driver][mysqld-5.6.22-log]Incorrect date value: ' 4/6/2015' for column

I had to recreate the table as it was missing so I am guessing that I created the column incorrectly and now need to alter it.

Any help would be appreciated.
AndersonHitchenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
TRY '2015/06/04 00:00:00'
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
You may need to format the date.  

MyDate=cdate("4/6/2015")
MyNewDate = year(MyDate)&"-"&right("0"&month(MyDate),2)&"-"&right("0"&day(MyDate),2)

Open in new window


Use MyNewDate to submit to mysql.
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you may want to consider using parameterized queries, thus eliminating issues like this

http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/A_3626-ASP-Classic-Using-Parameterized-Queries.html
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

SStoryCommented:
I was suggesting that the date may need to be quoted and in the standard format to be acceptable.
0
AndersonHitchenAuthor Commented:
Hi Again

As in my question I only need to alter the table not the code as the code works fine normally. Its only due to the fact that I have had to recreate the table for the upload data which has a datefield in it and I have not created that column correctly.

I was hoping that someone might have a solution to this.

Here is a snipet of code from the upload page that relates to the date which again shows that I only need to alter the date column to suit input.

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_connilease_STRING
    '                                                                        1                  2                        3                        4                              5                              
    MM_editCmd.CommandText = "INSERT INTO carimages (makeID, modelID, modelYear, fldImage, dateAdded) VALUES (?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, MM_IIF(UploadFormRequest("make"), UploadFormRequest("make"), null)) ' adDouble
         MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(UploadFormRequest("models"), UploadFormRequest("models"), null)) ' adDouble
      MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, UploadFormRequest("year")) ' adVarWChar
      MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, UploadFormRequest("img1")) ' adVarWChar
      MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 50, UploadFormRequest("SelectedDate")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

Cheers for the replies
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
your error message is complaining about a DATE format for the field, while in your code, you're defining it as an adVarWChar. Change your field to adVarcWChar or change your code to use a DATE data type
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
The last parameter should be

 MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 135, 1, -1, UploadFormRequest("SelectedDate")) ' adVarWChar
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.