Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27025

VS 2010 Storing date value in access

$
0
0
I was trying to store an date in my db table, for which i had used the following code.

Code:

cmd.CommandText = "Insert into Purchase (InvoiceDate) Values (@InvoiceDate)
cmd.parameters.addwithvalue("InvoiceDate", CDate(DateTimePicker1.Value))
cmd.ExecuteNonQuery

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

Viewing all articles
Browse latest Browse all 27025

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>