I was trying to store an date in my db table, for which i had used the following code.
when i was using the above code i got an error as "Data Type Mismatch"
but when i changed the parameter part as Cstr(DateTimePicker1.Value) i didnt get an error.
why wasn't is accepting the date
Code:
cmd.CommandText = "Insert into Purchase (InvoiceDate) Values (@InvoiceDate)
cmd.parameters.addwithvalue("InvoiceDate", CDate(DateTimePicker1.Value))
cmd.ExecuteNonQuery
but when i changed the parameter part as Cstr(DateTimePicker1.Value) i didnt get an error.
why wasn't is accepting the date