C# Converting or Parsing a Variable to DateTime -
i need write short piece of code take variable , convert datetime type. unfortunately keeps saying fine in build when run it, gives me error because not seeing variable, string.
datetime datevalue = (convert.todatetime("@deliverydate"));
you've misunderstood how variables work. in c#, variables need referenced identifier in code. c# not support string substitution of variables might find in language php.
assuming you've define variable in code, , populated value database:
… string deliverydate = (string)command.executescalar();
you can convert datetime
this:
datetime datevalue = convert.todatetime(deliverydate);
Comments
Post a Comment