How can I search for a date using DateTimePicker in VB.NET -
i have sample format of date in db 2/26/2014 10:14:04 am
how can search using datetimepicker?
i hope me. i'm still newbie.
sql = "select * tbltransact date =" & dtptd.value.date & "" cmd .connection = con .commandtext = sql end da.selectcommand = cmd da.fill(dt) datagridview1.datasource = dt
try making query way instead:
dim mydate datetime = dtptd.value.date sql = string.format("select * tbltransact year(date) = {0} , month(date) = {1} , day(date) = {2}", mydate.year, mydate.month, mydate.day)
this give records in tbltransact table selected day, regardless of time.
Comments
Post a Comment