r3plica
Well-known member
- Joined
- Mar 4, 2010
- Messages
- 86
- Programming Experience
- 3-5
I hate the datetime datatype. I always seem to run into issues with it.
Some times it works and other times I have to piss around with converting to strings and then formatting it manually into a format that my sql server will allow.
Here is my issue, surely there is an easy way (in sql) to fix this....
in vb.net I have some code that gets a date from a date picker and stores that date as string.
If I step through the code, I get this:
"03/05/2010"
In SQL I have a stored procedure that accepts a parameter which is a datetime data type.
For most days this was working fine, until the 03/05/2010 when it didnt work.
For the days after, it was fine again.
Stepping through the stored procedure I can see that the text is displayed as this:
2010-05-03 00:00:00.000
so for some reason it is not getting understood by SQL properly.
Does anyone have an easy fix to this. I know how to fix it by casting as a string and swapping the month/day/year around, but surely there must be an easier way?
Some times it works and other times I have to piss around with converting to strings and then formatting it manually into a format that my sql server will allow.
Here is my issue, surely there is an easy way (in sql) to fix this....
in vb.net I have some code that gets a date from a date picker and stores that date as string.
If I step through the code, I get this:
"03/05/2010"
In SQL I have a stored procedure that accepts a parameter which is a datetime data type.
For most days this was working fine, until the 03/05/2010 when it didnt work.
For the days after, it was fine again.
Stepping through the stored procedure I can see that the text is displayed as this:
2010-05-03 00:00:00.000
so for some reason it is not getting understood by SQL properly.
Does anyone have an easy fix to this. I know how to fix it by casting as a string and swapping the month/day/year around, but surely there must be an easier way?