Simple: don't call
ToString
at all.
You've declared your parameter as
SqlDbType.Date
. That means it expects a date value, not a string.
Either:
cmd.Parameters.AddWithValue("@Jdate", System.DateTime.Today);
or:
cmd.Parameters.Add("@Jdate", SqlDbType.Date).Value = DateTime.Today;
will work.
Quote:
"DateTime.Now is a namespace but it is used like a variable"
That suggests you've either created a file with a namespace of
DateTime.Now
, or you're missing the
using System;
directive from the top of your file.
If you've created a file in that namespace, I'd strongly suggest you change it. Creating namespaces with the same name as a built-in type is not a good idea.