c# - Using DateTimePicker to specify my ReportViewer in MS Access -
so use datetimepicker parameter display specific dates database, report generating dates based on today, though i've tried using other dates. please help, stuck.
private void button1_click(object sender, eventargs e) { datatable dt = new datatable(); try { oledbcommand com = new oledbcommand(); oledbdataadapter adapter = new oledbdataadapter(); connection.open(); com.connection = connection; if (true) { com.commandtext = string.format("select customer.cid, customer.firstname, customer.lastname, customer.mobilecontactnumber, booking.vehiclenumber, customer.membertype, customer.points, booking.[date], booking.[time] (booking inner join customer on booking.cid = customer.cid) booking.[date] = ' "+datetimepicker1.value+"'"); adapter.selectcommand = com; adapter.fill(dt); } this.datatable1tableadapter.fill(this.reportxsd.datatable1); this.reportviewer1.refreshreport(); connection.close(); } catch (exception ex) { throw ex; } }
Comments
Post a Comment