0

I am using VB 2008 and have a datetime picker. I wam trying to use this value in an INSERT command to load in to a table but I just can't get it to work. I debug it out which shows something along the lines of "24/03/2010" but it just won't accept it. However, if I create a string variable e.g. strDate = "24/03/2010". it works. I am obviously doing something wrong in the conversion. Don't suppose someone could tell me what.

Thanks

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by chetanbasuray
0

Thanks for the reply Renukavani.

Managed to sort it by using the format command. I didn't realise you had to insert it using the format yyyy-mm-dd.

0

Hi,

I am facing the same issue.Please help me how u had solved it.
I am using VS 2008,windows form ,SQL server2008 express :

"INSERT bill_book (PostingDate) VALUES ( '" & Dtp_bill.Text & " ' )"

in sql data type for PostingDate is "Date"

0

The format that SQL server uses to store date is yyyy-mm-dd
When taking the date as input make sure you take it in this format, u can change the format from the properties window while putting the date time picker, as well as manually from code.
If you are inputting the date through keyboard, make sure u input it in the above format.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.