Resolved Conversion failed when converting date and/or time from character string

peterc

Member
Joined
Jan 5, 2016
Messages
16
Programming Experience
1-3
Okay, not sure if right part of forum to ask the question, but this one is stumping me, and some direction is needed.........

On my computer which has visual studio installed, when I click on the save form button, it reports job saved.

However on all the other computers in the office, when they run the application and click on save form, it gives the error "conversion failed when converting date and/or time from character string"

So I am looking at the code, and see nothing at this stage. Does anyone have any pointers as to how to go about seeing where the problem may be.

Thanks in advance
 
Last edited:
You have marked this thread Resolved but not specified what the resolution was. Please do so so that others with similar issues may benefit. My guess is that some values were being entered in different formats to what your app was assuming. There are good and bad ways to avoid such issues. If you provide details of how the data is being entered and how it's being used then we may be able to offer advice for a better solution.
 
Someone else may be able to understand what and why, I sort of stumbled along and managed to resolve it.

On my computer the date was showing as "dd Month yyyy" on the screen, but on the other computers it was showing as "Weekday dd mm yyyy".

When parsing the data from the form to the sql update statement, I was passing it as a string.....

On the date field that was giving me an error I included a Cdate(date) instead of just date, and this resolved the problem.

Have now changed all my date functions to be cdate for saving.
 
That sounds bad for a number of reasons. If there's any converting to be done, it should be done in the application and then a binary DateTime value sent to the database via a parameter. Where EXACTLY is this date coming from? Is the user entering it? If so, what are they entering it into? What type of application is it?
 
Back
Top