Check the type of dr["invoice date"] locally and make sure it's not a
DateTime - if it is I think ShortDateString() instead of ToString() should
work.
BTW, I totally agree with Miha here - you really don't get any benefit by
using NVarchar for dates and in all likelihood- you'll need to sort on them
sometime in the future and you'll just have to cast everything again.
--
W.G. Ryan MVP (Windows Embedded)
TiBA Solutions
www.tibasolutions.com |
www.devbuzz.com |
www.knowdotnet.com
<(E-Mail Removed)> wrote in message
news:E9972E39-7E45-4751-A50F-(E-Mail Removed)...
> I have SQL parameter that looks like this:
>
> cmdUpdate.Parameters.Add
> ("@invoicedate", SqlDbType.NVarChar, 40).Value = dr["invoice
> date"].ToString();
>
> IT is updating a field in a SQL2K database.
> The database field is of type char and not date.
>
> The data in dr["invoice date"] looks like this:
>
> 12/29/2004
>
> But when the field is updated the database looks like this.
>
> 2/4/2004 12:00:00 AM .
>
> How do I get it formated correctly.
>
> Thanks
>
> Paul
>
>
>
>