Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stored procedure can't execute date format problem

Status
Not open for further replies.

xtremeLogic

Programmer
Dec 19, 2003
53
CA
Hi,

I have a sql server stored procedure that I would like to execute from vb.net. The problem is that it won't complete the insert into the table because of the date being sent. I am getting the date from a form field so I format it like

Format("{0:MM/dd/yyyy}", docDate)

However, it does not complete the stored proc as it somehow converts the data being passed into some long format. I traced the execution of the stored proc and got the following date parameter being sent to the db:
'Jan 20 2004 12:00:00:000AM' (this is not what I specified)

The problem with that is that because of the length of it, the db doesn't accept. The field in my db is of type datetime.

Any suggestions would be greatly appreciated
 
Try passing
Code:
Convert.ToDateTime(dateValue)
or
Code:
(Convert.ToDateTime(dateValue)).ToShortDateString()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top