Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 [Resolved] Convert Date

Author  Topic 

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2011-01-25 : 14:47:16
Need to call a sp and pass a date field as parm.

Date is a textbox as mm/dd/yyyy (selected from a calendar pop up) and my parm field is sqldbtype.datetime format yyyy-mm-dd. How can I achieve this easily?

myCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@DateFrom", Data.SqlDbType.DateTime)).Value = CDate(TextBox4.Text)???????

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-01-25 : 14:48:49
If the parameter is declared as a Datetime then you don't need to do anything with the "format". Date format has nothing to do with date value.
Go to Top of Page

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2011-01-25 : 16:14:13
Thank you, great!
Go to Top of Page
   

- Advertisement -