Here is the code
Dim SqlMetroDateMin As String = "select top 1 Format(E13A101.TIME, 'yyyy/mm/dd')AS tmin from E13A101 where fmin=(select min(fmin) from E13A101 where month(TIME)= " & ddlMonth.SelectedValue & " and year(TIME)= " & ddlYear.SelectedValue & " ) and month(TIME)= " & ddlMonth.SelectedValue & " and year(TIME)= " & ddlYear.SelectedValue
Dim cmd As New OleDbCommand(SqlMetroDateMin, conn)
conn.Open()
lblDateMin.Text = cmd.ExecuteScalar().ToString()
conn.Close()
if there is no min date, I will get NullReferenceException error. I was wondering how can I check for the null before I run cmd.ExecuteScalar().ToString command.
Thanks
Dim SqlMetroDateMin As String = "select top 1 Format(E13A101.TIME, 'yyyy/mm/dd')AS tmin from E13A101 where fmin=(select min(fmin) from E13A101 where month(TIME)= " & ddlMonth.SelectedValue & " and year(TIME)= " & ddlYear.SelectedValue & " ) and month(TIME)= " & ddlMonth.SelectedValue & " and year(TIME)= " & ddlYear.SelectedValue
Dim cmd As New OleDbCommand(SqlMetroDateMin, conn)
conn.Open()
lblDateMin.Text = cmd.ExecuteScalar().ToString()
conn.Close()
if there is no min date, I will get NullReferenceException error. I was wondering how can I check for the null before I run cmd.ExecuteScalar().ToString command.
Thanks