Page 1 of 1

Send dates from VB.NET to WHERE

Posted: Tue Oct 02, 2007 7:57 pm
by DAVE_I
I^m using Infinity and the OCX controls to run reports. I have a screen in my app where I prompt the user for a string to filter on and a couple of dates (using Calendar controls). I need to send those values to a couple of reports which will run sequentially. Since I struggled but finally succeeded in passing the dates to the WHERE for the OCX control, I thought I^d share a code snippet with anyone interested:____Dim sfirstdate As String = ""____sfirstdate = System.Convert.ToString(Me.FirstDateMonthCalendar1.SelectionRange.Start.ToString("yyyy-MM-dd"))____Dim sEndDate As String = ""__sEndDate = System.Convert.ToString(Me.EndDateMonthCalendar1.SelectionRange.Start.ToString("yyyy-MM-dd"))____Me.RSReport1.Where = "IE_LINK.INSERV_NO=^" settings.InserviceNumber "^" " AND IE_LINK.ATDATE >= {d ^" sfirstdate "^} And IE_LINK.ATDATE <= {d ^" sEndDate "^}"____Me.RSReport1.RunReport(1)