Iam using an application that gets data through a communication protocol , and among data i get is dates and i managed to form a string date out of that in this form :
"dd/MM/yyyy HH:mm:ss.mmm"
I want to insert it in the database :
updateEvent_list = "INSERT INTO Events_List (date, Object,Event,IOA,ASDU) VALUES(@date, @event_object, @Event, @IOA, @ASDU)";
The date column
is of datetime2
type .
Question is : how can i convert the string i get into datetime2
???
EDIT :
In fact i have two types of dates to insert :
1) Frames that come with time tag : the ones that i convert their dates to string.
2) Frames that come without timetag : Iam using DateTime date =DateTime.UtcNow
Each of these work perfectly when they implemented independantly
Is there any solution that permits using both in the same program ??