c# - How to convert simple date from textbox to datetime in mysql? -
I have a date in the text box 2014-17-04 i.e. (YYYY-DD-MM) to put it For wnt 2014-04-17 00:00:00 databases like this, how can I do this I have tried like the following ..
ssQL = "DateMaster (Birthday) values Include ('"+ Convert. Dataset (txtBirthdate.Text) +"') "; But this error returns that "string was not recognized as a valid date time", so how can I insert values into the database using MySQL DATE_FORMAT?
Try a date test or test the test Exam test
datetime DT; If (DatedTimeTripesExact (TCTTTXact, "YYY-DD-MM", Culture Info. InverterTilter, Datetime Style No, Out DT)) Include {var insert = "DateMaster (Birthdate)" (@Barthadet) "; (SqlCommand CMD = Using new SqlCommand (insert, your connection)) {cmd.CommandType = CommandType.Text; Cmd.Parameters.AddWithValue ("Date of Birth", DT); cmd.Connection.Open (); Cmd.ExecuteNonQuery (); }} yyyy-dd-MM matches the inputs you want and as @Jobsquet added, to avoid the injection, always query the parameter Use
Comments
Post a Comment