I have a Monthcalendar from which a date is chosen and a button is clicked. I can store this and have tried formatting it a number of ways so it can be used in an SQL statement to list all incidents which were recorded after that date.
PrivateSub MonthCalendar1_DateSelected(ByVal sender AsObject, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
Dim date_chosen AsString
date_chosen = MonthCalendar1.SelectionEnd
Button1.Text = MonthCalendar1.SelectionEnd & Environment.NewLine & "Click here"
Dim dateTimeInfo AsDateTime = date_chosen
Dim strMonth AsString = dateTimeInfo.ToString("d")
Db.Open(DB_SQL)
Format$(strMonth,"dd/mm/yyyy")
MsgBox(strMonth) - this seems to throw out the correct "date"
rs3.Open("select * from TBL_Student_RSS where datetime > strMonth", Db)This rs3... is resulting in the nullreferenceexception error.
Dim myDA As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
Dim myDS AsDataSet = NewDataSet
myDA.Fill(myDS, rs3, "MyTable")
DataGridView1.DataSource = myDS.Tables("Mytable")
Db.Close()
EndSub
It must be obvious but I searched numerous web sites and come up with confusion.
Any help would be very welcome
PrivateSub MonthCalendar1_DateSelected(ByVal sender AsObject, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
Dim date_chosen AsString
date_chosen = MonthCalendar1.SelectionEnd
Button1.Text = MonthCalendar1.SelectionEnd & Environment.NewLine & "Click here"
Dim dateTimeInfo AsDateTime = date_chosen
Dim strMonth AsString = dateTimeInfo.ToString("d")
Db.Open(DB_SQL)
Format$(strMonth,"dd/mm/yyyy")
MsgBox(strMonth) - this seems to throw out the correct "date"
rs3.Open("select * from TBL_Student_RSS where datetime > strMonth", Db)This rs3... is resulting in the nullreferenceexception error.
Dim myDA As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
Dim myDS AsDataSet = NewDataSet
myDA.Fill(myDS, rs3, "MyTable")
DataGridView1.DataSource = myDS.Tables("Mytable")
Db.Close()
EndSub
It must be obvious but I searched numerous web sites and come up with confusion.
Any help would be very welcome