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

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -